Mercurial > ecos
changeset 2525:33cc410733a0
Eliminate various compiler warnings, fix typos, etc.
| author | bartv |
|---|---|
| date | Thu, 14 Aug 2008 21:38:29 +0000 |
| parents | 8db3f8136a70 |
| children | cb3aa3606536 |
| files | host/libcdl/ChangeLog host/libcdl/build.cxx host/libcdl/cdl.hxx host/libcdl/cdlcore.hxx host/libcdl/cdlmisc.cxx host/libcdl/component.cxx host/libcdl/config.cxx host/libcdl/conflict.cxx host/libcdl/database.cxx host/libcdl/dialog.cxx host/libcdl/doc/reference.sgml host/libcdl/interface.cxx host/libcdl/interp.cxx host/libcdl/option.cxx host/libcdl/package.cxx host/libcdl/parse.cxx host/libcdl/value.cxx host/libcdl/wizard.cxx |
| diffstat | 18 files changed, 65 insertions(+), 49 deletions(-) [+] |
line wrap: on
line diff
--- a/host/libcdl/ChangeLog +++ b/host/libcdl/ChangeLog @@ -1,3 +1,12 @@ +2008-08-14 Bart Veer <bartv@ecoscentric.com> + + * doc/reference.sgml: fix typo. + + * wizard.cxx, value.cxx, parse.cxx, package.cxx, option.cxx, + interp.cxx, interface.cxx, dialog.cxx, database.cxx, conflict.cxx, + config.cxx, component.cxx, cdlmisc.cxx, cdlcore.hxx, cdl.hxx, + build.cxx: fix various compiler warnings. + 2004-06-23 John Dallaway <jld@ecoscentric.com> * interp.cxx (locate_subdirs): Avoid use of a trailing period in
--- a/host/libcdl/build.cxx +++ b/host/libcdl/build.cxx @@ -48,6 +48,8 @@ // ---------------------------------------------------------------------------- #include "cdlconfig.h" +#include <cstring> + // Get the infrastructure types, assertions, tracing and similar // facilities. #include <cyg/infra/cyg_ass.h> @@ -212,7 +214,7 @@ int CdlBuildableBody::parse_compile(CdlInterpreter interp, int argc, const char* argv[]) { CYG_REPORT_FUNCNAMETYPE("parse_compile", "result %d"); - static char* options[] = { + static const char* options[] = { "library:", 0 }; @@ -391,7 +393,7 @@ int CdlBuildableBody::parse_make(CdlInterpreter interp, int argc, const char* argv[]) { CYG_REPORT_FUNCNAMETYPE("parse_make", "result %d"); - static char* options[] = { + static const char* options[] = { "priority:", 0 }; @@ -445,7 +447,7 @@ int CdlBuildableBody::parse_make_object(CdlInterpreter interp, int argc, const char* argv[]) { CYG_REPORT_FUNCNAMETYPE("parse_make_object", "result %d"); - static char* options[] = { + static const char* options[] = { "library:", "priority:", 0 @@ -466,7 +468,7 @@ int CdlBuildableBody::parse_object(CdlInterpreter interp, int argc, const char* argv[]) { CYG_REPORT_FUNCNAMETYPE("parse_object", "result %d"); - static char* options[] = { + static const char* options[] = { "library:", 0 }; @@ -702,11 +704,11 @@ CdlBuildableBody::update_all_build_info( // ---------------------------------------------------------------------------- // This variable controls the default library that should be generated. // Some applications may wish to override this. -char* CdlBuildLoadableBody::default_library_name = "libtarget.a"; +const char* CdlBuildLoadableBody::default_library_name = "libtarget.a"; // The pattern that should be used to identify header files. // FIXME: this information should come out of a data file -char* CdlBuildLoadableBody::default_headers_glob_pattern = "*.h *.hxx *.inl *.si *.inc"; +const char* CdlBuildLoadableBody::default_headers_glob_pattern = "*.h *.hxx *.inl *.si *.inc"; //}}} //{{{ The simple stuff @@ -1424,7 +1426,7 @@ CdlDefinableBody::parse_define(CdlInterp { CYG_REPORT_FUNCNAMETYPE("parse_define", "result %d"); - static char* options[] = { + static const char* options[] = { "file:", "format:", 0 @@ -1507,7 +1509,7 @@ CdlDefinableBody::parse_if_define(CdlInt { CYG_REPORT_FUNCNAMETYPE("parse_if_define", "result %d"); - char* options[] = { + const char* options[] = { "file:", 0 };
--- a/host/libcdl/cdl.hxx +++ b/host/libcdl/cdl.hxx @@ -216,7 +216,7 @@ class CdlPackagesDatabaseBody { // This allows test cases to overwrite the name of the file // containing the database information. - static char* database_name; + static const char* database_name; // Control whether or not minor problems with the database should be // reported.
--- a/host/libcdl/cdlcore.hxx +++ b/host/libcdl/cdlcore.hxx @@ -1341,7 +1341,7 @@ class CdlInterpreterBody static int tcl_command_proc(ClientData, Tcl_Interp*, int, const char*[]); // This key is used to access the CdlInterpreter assoc data. - static char* cdlinterpreter_assoc_data_key; + static const char* cdlinterpreter_assoc_data_key; // Do not allow static instances of a Cdl interpreter. There are too // many possible failure conditions. Cdl interpreters can only be @@ -3326,7 +3326,7 @@ class CdlParse { // Utility routines. static std::string get_tcl_cmd_name(std::string); static std::string concatenate_argv(int, const char*[], int); - static int parse_options(CdlInterpreter, std::string /* diag_prefix */, char** /* options */, + static int parse_options(CdlInterpreter, std::string /* diag_prefix */, const char** /* options */, int /* argc */, const char*[] /* argv */, int /* start_index */, std::vector<std::pair<std::string,std::string> >& /* result */); static std::string construct_diagnostic(CdlInterpreter, std::string /* classification */, @@ -3351,26 +3351,26 @@ class CdlParse { // Utility parsing routines static int parse_minimal_property(CdlInterpreter, int, const char*[], std::string, - char**, void (*)(CdlInterpreter, CdlProperty_Minimal)); + const char**, void (*)(CdlInterpreter, CdlProperty_Minimal)); static int parse_string_property(CdlInterpreter, int, const char*[], std::string, - char**, void (*)(CdlInterpreter, CdlProperty_String)); + const char**, void (*)(CdlInterpreter, CdlProperty_String)); static int parse_tclcode_property(CdlInterpreter, int, const char*[], std::string, - char**, void (*)(CdlInterpreter, CdlProperty_TclCode)); + const char**, void (*)(CdlInterpreter, CdlProperty_TclCode)); static int parse_stringvector_property(CdlInterpreter, int, const char*[], std::string, - char**, void (*)(CdlInterpreter, CdlProperty_StringVector), + const char**, void (*)(CdlInterpreter, CdlProperty_StringVector), bool /* allow_empty */ = false); static int parse_reference_property(CdlInterpreter, int, const char*[], std::string, - char**, void (*)(CdlInterpreter, CdlProperty_Reference), + const char**, void (*)(CdlInterpreter, CdlProperty_Reference), bool /* allow_empty */, CdlUpdateHandler); static int parse_expression_property(CdlInterpreter, int, const char*[], std::string, - char **, void (*)(CdlInterpreter, CdlProperty_Expression), + const char **, void (*)(CdlInterpreter, CdlProperty_Expression), CdlUpdateHandler); static int parse_listexpression_property(CdlInterpreter, int, const char*[], std::string, - char **, void (*)(CdlInterpreter, CdlProperty_ListExpression), + const char **, void (*)(CdlInterpreter, CdlProperty_ListExpression), CdlUpdateHandler); static int parse_goalexpression_property(CdlInterpreter, int, const char*[], std::string, - char **, void (*)(CdlInterpreter, CdlProperty_GoalExpression), + const char **, void (*)(CdlInterpreter, CdlProperty_GoalExpression), CdlUpdateHandler); }; @@ -4276,7 +4276,7 @@ class CdlValuableBody : virtual public C static void wizard_update_handler(CdlTransaction, CdlNode, CdlProperty, CdlNode, CdlUpdate); // Persistence suppot - void save(CdlInterpreter, Tcl_Channel, int, bool /* modifiable */, bool /* minimal */); + void save_valuable(CdlInterpreter, Tcl_Channel, int, bool /* modifiable */, bool /* minimal */); bool value_savefile_entry_needed() const; static void initialize_savefile_support(CdlToplevel, std::string); static int savefile_value_source_command(CdlInterpreter, int, const char*[]); @@ -5395,12 +5395,12 @@ class CdlBuildLoadableBody : virtual pub // By default any compiled files will go into libtarget.a, which // is the default value for this variable. Individual applications may // specify an alternative default library. - static char* default_library_name; + static const char* default_library_name; // When filling in a build_info structure the library needs to know // what constitutes a header file. A glob pattern can be used for this. // NOTE: in the long term this should come out of a data file. - static char* default_headers_glob_pattern; + static const char* default_headers_glob_pattern; virtual std::string get_class_name() const; bool check_this(cyg_assert_class_zeal = cyg_quick) const;
--- a/host/libcdl/cdlmisc.cxx +++ b/host/libcdl/cdlmisc.cxx @@ -67,6 +67,9 @@ // For access to strtod() #include <cstdlib> +// For strcpy() +#include <cstring> + // strtod() involves errno... #include <cerrno> @@ -661,7 +664,7 @@ Cdl::double_to_integer(double value, cdl // Conversions between strings and flavors. static struct { - char* name; + const char* name; CdlValueFlavor flavor; } valid_flavors[] = { { "none", CdlValueFlavor_None }, @@ -735,7 +738,7 @@ Cdl::flavor_to_string(CdlValueFlavor fla // Similar support for value sources. static struct { - char* name; + const char* name; CdlValueSource source; } valid_sources[] = { { "default", CdlValueSource_Default },
--- a/host/libcdl/component.cxx +++ b/host/libcdl/component.cxx @@ -392,7 +392,7 @@ CdlComponentBody::save(CdlInterpreter in // Deal with the value bool modifiable = !(CdlValueFlavor_None == this->get_flavor()) && !this->has_property(CdlPropertyId_Calculated); - this->CdlValuableBody::save(interp, chan, indentation + 4, modifiable, minimal); + this->CdlValuableBody::save_valuable(interp, chan, indentation + 4, modifiable, minimal); // And with any unrecognised data this->CdlNodeBody::save(interp, chan, indentation + 4, minimal);
--- a/host/libcdl/config.cxx +++ b/host/libcdl/config.cxx @@ -1782,7 +1782,7 @@ CdlConfigurationBody::savefile_package_c CdlPackage pkg = 0; std::vector<std::pair<std::string,std::string> > options; - static char* optlist[] = { + static const char* optlist[] = { "template:f", "hardware:f", 0
--- a/host/libcdl/conflict.cxx +++ b/host/libcdl/conflict.cxx @@ -791,7 +791,7 @@ CdlConflict_EvalExceptionBody::get_expla CYG_PRECONDITION_THISC(); std::string result = node->get_name() + ", property " + property->get_property_name() + "\n"; - result += "Error while evaluation expression: "; + result += "Error while evaluating expression: "; if ("" != explanation) { result += explanation; }
--- a/host/libcdl/database.cxx +++ b/host/libcdl/database.cxx @@ -71,7 +71,7 @@ // ---------------------------------------------------------------------------- // Some test cases may want to read in a file other than // "ecos.db", e.g. to facilitate testing the error conditions. -char* +const char* CdlPackagesDatabaseBody::database_name = "ecos.db"; // Should warnings be issued for minor database inconsistencies?
--- a/host/libcdl/dialog.cxx +++ b/host/libcdl/dialog.cxx @@ -106,8 +106,8 @@ CdlDialogBody::dialogs_are_enabled() // There is no data associated with a custom dialog object. CdlDialogBody::CdlDialogBody(std::string name_arg) : CdlNodeBody(name_arg), - CdlParentableBody(), - CdlUserVisibleBody() + CdlUserVisibleBody(), + CdlParentableBody() { CYG_REPORT_FUNCNAME("CdlDialogBody:: constructor"); CYG_REPORT_FUNCARG1XV(this);
--- a/host/libcdl/doc/reference.sgml +++ b/host/libcdl/doc/reference.sgml @@ -1709,7 +1709,7 @@ sufficient. Sometimes it is useful to ha <literal>#define's</literal> get generated. </para> <para> -The &define; property can be used to generate an addition +The &define; property can be used to generate an additional <literal>#define</literal> if the option is both active and enabled, for example: </para>
--- a/host/libcdl/interface.cxx +++ b/host/libcdl/interface.cxx @@ -367,7 +367,7 @@ CdlInterfaceBody::save(CdlInterpreter in interp->write_data(chan, data); // Deal with the value - this->CdlValuableBody::save(interp, chan, indentation + 4, false, minimal); + this->CdlValuableBody::save_valuable(interp, chan, indentation + 4, false, minimal); // Close the cdl_interface body. A blank line is added here. data = "};\n\n";
--- a/host/libcdl/interp.cxx +++ b/host/libcdl/interp.cxx @@ -68,7 +68,7 @@ // ---------------------------------------------------------------------------- // This key is used for accessing AssocData in the Tcl interpreters, // specifically the CdlInterpreter object. -char* CdlInterpreterBody::cdlinterpreter_assoc_data_key = "__cdlinterpreter"; +const char* CdlInterpreterBody::cdlinterpreter_assoc_data_key = "__cdlinterpreter"; CYGDBG_DEFINE_MEMLEAK_COUNTER(CdlInterpreterBody);
--- a/host/libcdl/option.cxx +++ b/host/libcdl/option.cxx @@ -295,7 +295,7 @@ CdlOptionBody::save(CdlInterpreter inter // Deal with the value bool modifiable = !(CdlValueFlavor_None == this->get_flavor()) && !this->has_property(CdlPropertyId_Calculated); - this->CdlValuableBody::save(interp, chan, indentation + 4, modifiable, minimal); + this->CdlValuableBody::save_valuable(interp, chan, indentation + 4, modifiable, minimal); // And with any unrecognised data this->CdlNodeBody::save(interp, chan, indentation + 4, minimal);
--- a/host/libcdl/package.cxx +++ b/host/libcdl/package.cxx @@ -498,7 +498,7 @@ CdlPackageBody::save(CdlInterpreter inte interp->write_data(chan, data); // Deal with the value - this->CdlValuableBody::save(interp, chan, indentation + 4, false, minimal); + this->CdlValuableBody::save_valuable(interp, chan, indentation + 4, false, minimal); // And with any unrecognised data this->CdlNodeBody::save(interp, chan, indentation + 4, minimal);
--- a/host/libcdl/parse.cxx +++ b/host/libcdl/parse.cxx @@ -49,6 +49,8 @@ // ---------------------------------------------------------------------------- #include "cdlconfig.h" +#include <cstring> + // Get the infrastructure types, assertions, tracing and similar // facilities. #include <cyg/infra/cyg_ass.h> @@ -210,7 +212,7 @@ CdlParse::concatenate_argv(int argc, con // or terminating flags. static std::string -get_option_string(char* name) +get_option_string(const char* name) { std::string result = ""; while ((*name != ':') && (*name != '\0')) { @@ -220,7 +222,7 @@ get_option_string(char* name) } int -CdlParse::parse_options(CdlInterpreter interp, std::string diag_prefix, char** options, +CdlParse::parse_options(CdlInterpreter interp, std::string diag_prefix, const char** options, int argc, const char* argv[], int index, std::vector<std::pair<std::string,std::string> >& result) { @@ -295,7 +297,7 @@ CdlParse::parse_options(CdlInterpreter i // The option has been identified successfully. Extract the flags. bool flag_flag = false; bool multiple_flag = false; - char* tmp = options[opt_index]; + const char* tmp = options[opt_index]; while (('\0' != *tmp) && (':' != *tmp)) { tmp++; } @@ -731,7 +733,7 @@ CdlParse::report_property_parse_warning( int CdlParse::parse_minimal_property(CdlInterpreter interp, int argc, const char* argv[], std::string name, - char** options_desc, void (*final_parser)(CdlInterpreter, CdlProperty_Minimal)) + const char** options_desc, void (*final_parser)(CdlInterpreter, CdlProperty_Minimal)) { CYG_REPORT_FUNCNAME("parse_minimal_property"); CYG_PRECONDITION_CLASSC(interp); @@ -772,7 +774,7 @@ CdlParse::parse_minimal_property(CdlInte int CdlParse::parse_string_property(CdlInterpreter interp, int argc, const char* argv[], std::string name, - char** options_desc, void (*final_parser)(CdlInterpreter, CdlProperty_String)) + const char** options_desc, void (*final_parser)(CdlInterpreter, CdlProperty_String)) { CYG_REPORT_FUNCNAME("parse_string_property"); CYG_PRECONDITION_CLASSC(interp); @@ -814,7 +816,7 @@ CdlParse::parse_string_property(CdlInter int CdlParse::parse_tclcode_property(CdlInterpreter interp, int argc, const char* argv[], std::string name, - char** options_desc, void (*final_parser)(CdlInterpreter, CdlProperty_TclCode)) + const char** options_desc, void (*final_parser)(CdlInterpreter, CdlProperty_TclCode)) { CYG_REPORT_FUNCNAME("parse_tclcode_property"); CYG_PRECONDITION_CLASSC(interp); @@ -857,7 +859,7 @@ CdlParse::parse_tclcode_property(CdlInte int CdlParse::parse_stringvector_property(CdlInterpreter interp, int argc, const char* argv[], std::string name, - char** options_desc, void (*final_parser)(CdlInterpreter, CdlProperty_StringVector), + const char** options_desc, void (*final_parser)(CdlInterpreter, CdlProperty_StringVector), bool allow_empty) { CYG_REPORT_FUNCNAME("parse_tclcode_property"); @@ -902,7 +904,7 @@ CdlParse::parse_stringvector_property(Cd int CdlParse::parse_reference_property(CdlInterpreter interp, int argc, const char* argv[], std::string name, - char** options_desc, void (*final_parser)(CdlInterpreter, CdlProperty_Reference), + const char** options_desc, void (*final_parser)(CdlInterpreter, CdlProperty_Reference), bool allow_empty, CdlUpdateHandler update_handler) { CYG_REPORT_FUNCNAME("parse_reference_property"); @@ -948,7 +950,7 @@ CdlParse::parse_reference_property(CdlIn int CdlParse::parse_expression_property(CdlInterpreter interp, int argc, const char* argv[], std::string name, - char** options_desc, void (*final_parser)(CdlInterpreter, CdlProperty_Expression), + const char** options_desc, void (*final_parser)(CdlInterpreter, CdlProperty_Expression), CdlUpdateHandler update_handler) { CYG_REPORT_FUNCNAME("parse_expression_property"); @@ -1007,7 +1009,7 @@ CdlParse::parse_expression_property(CdlI int CdlParse::parse_listexpression_property(CdlInterpreter interp, int argc, const char* argv[], std::string name, - char** options_desc, void (*final_parser)(CdlInterpreter, CdlProperty_ListExpression), + const char** options_desc, void (*final_parser)(CdlInterpreter, CdlProperty_ListExpression), CdlUpdateHandler update_handler) { CYG_REPORT_FUNCNAME("parse_list_expression_property"); @@ -1061,7 +1063,7 @@ CdlParse::parse_listexpression_property( int CdlParse::parse_goalexpression_property(CdlInterpreter interp, int argc, const char* argv[], std::string name, - char** options_desc, void (*final_parser)(CdlInterpreter, CdlProperty_GoalExpression), + const char** options_desc, void (*final_parser)(CdlInterpreter, CdlProperty_GoalExpression), CdlUpdateHandler update_handler) { CYG_REPORT_FUNCNAMETYPE("parse_goal_expression_property", "result %d");
--- a/host/libcdl/value.cxx +++ b/host/libcdl/value.cxx @@ -3694,7 +3694,7 @@ follow_expr_references(CdlProperty prope // ---------------------------------------------------------------------------- void -CdlValuableBody::save(CdlInterpreter interp, Tcl_Channel chan, int indentation, bool modifiable, bool minimal) +CdlValuableBody::save_valuable(CdlInterpreter interp, Tcl_Channel chan, int indentation, bool modifiable, bool minimal) { CYG_REPORT_FUNCNAME("CdlValuable::save"); CYG_REPORT_FUNCARG5XV(this, interp, chan, indentation, minimal);
--- a/host/libcdl/wizard.cxx +++ b/host/libcdl/wizard.cxx @@ -73,8 +73,8 @@ CYGDBG_DEFINE_MEMLEAK_COUNTER(CdlWizardB // Constructor. The real work is actually done in the parse routine. CdlWizardBody::CdlWizardBody(std::string name_arg) : CdlNodeBody(name_arg), - CdlParentableBody(), - CdlUserVisibleBody() + CdlUserVisibleBody(), + CdlParentableBody() { CYG_REPORT_FUNCNAME("CdlWizardBody:: constructor"); CYG_REPORT_FUNCARG1XV(this);
