From: Fred T. Hamster Date: Mon, 9 Feb 2026 15:20:19 +0000 (-0500) Subject: holy crowbar lots of callstack tracker changes X-Git-Tag: 2.140.190^2~14 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=b32cb7b88e7e9c73eb92adcefb963be17f407122;p=feisty_meow.git holy crowbar lots of callstack tracker changes this was an attempt to bring back in the callstack tracker feature, after maybe 15 years of it not being alive in the codebase. lots of struggle with that, and it's not working yet, but is a bit better. currently the feature is disabled in the codebase, but hopefully it can be enabled soon... --- diff --git a/nucleus/library/application/callstack_tracker.cpp b/nucleus/library/application/callstack_tracker.cpp index 4194bbee..5f57dd36 100644 --- a/nucleus/library/application/callstack_tracker.cpp +++ b/nucleus/library/application/callstack_tracker.cpp @@ -1,11 +1,8 @@ - - - -/*****************************************************************************\ -* * -* Name : callstack_tracker * -* Author : Chris Koeritz * -* * +/* +* +* Name : callstack_tracker +* Author : Chris Koeritz +* ******************************************************************************* * Copyright (c) 2007-$now By Author. This program is free software; you can * * redistribute it and/or modify it under the terms of the GNU General Public * @@ -24,11 +21,27 @@ #include "callstack_tracker.h" +#include + #include #include +#include + +//using namespace application; +using namespace basis; +//using namespace configuration; +//using namespace mathematics; +//using namespace filesystem; +//using namespace loggers; +//using namespace structures; +//using namespace textual; +//using namespace timely; +//using namespace unit_test; ////#undef new -//is this right way to clean that out. +//is this right way to clean that out..? + +namespace application { const int MAX_STACK_DEPTH = 2000; // beyond that many stack frames, we will simply refuse to add any more. @@ -41,6 +54,34 @@ const char *emptiness_note = "Empty Stack\n"; ////////////// +//! the single instance of callstack_tracker. +/*! this is also an ultra low-level object, although it's not as far down +as the memory checker. it can allocate c++ objects and that kind of thing +just fine. the object must be stored here rather than in the static basis +library due to issues in windows dlls. +NOTE: this is also not thread safe; it must be initialized before any threads +have started. */ + +//hmmm: why is this here? because it needs to interact with the progwide memories? +callstack_tracker &program_wide_stack_trace() +{ + static callstack_tracker *_hidden_trace = NULL_POINTER; + if (!_hidden_trace) { +#ifdef ENABLE_MEMORY_HOOK + program_wide_memories().disable(); + // we don't want infinite loops tracking the call stack during this + // object's construction. +#endif + _hidden_trace = new callstack_tracker; +#ifdef ENABLE_MEMORY_HOOK + program_wide_memories().enable(); +#endif + } + return *_hidden_trace; +} + +////////////// + class callstack_records { public: @@ -265,8 +306,7 @@ void update_current_stack_frame_line_number(int line) //printf("frametrackinst updatelinenum out\n"); } -#endif // ENABLE_CALLSTACK_TRACKING - - +} // namespace +#endif // ENABLE_CALLSTACK_TRACKING diff --git a/nucleus/library/application/callstack_tracker.h b/nucleus/library/application/callstack_tracker.h index bb75adaa..a8e83169 100644 --- a/nucleus/library/application/callstack_tracker.h +++ b/nucleus/library/application/callstack_tracker.h @@ -15,22 +15,21 @@ * Please send any updates to: fred@gruntose.com * \*****************************************************************************/ -#include "definitions.h" - -#ifdef ENABLE_CALLSTACK_TRACKING - -#include "build_configuration.h" -#include "root_object.h" +#include +#include +#include namespace application { +#ifdef ENABLE_CALLSTACK_TRACKING + // forward. class callstack_records; class callstack_tracker; ////////////// -callstack_tracker BASIS_EXTERN &program_wide_stack_trace(); +callstack_tracker &program_wide_stack_trace(); //!< a global object that can be used to track the runtime callstack. ////////////// @@ -49,7 +48,7 @@ public: callstack_tracker(); virtual ~callstack_tracker(); - DEFINE_CLASS_NAME("callstack_tracker"); +// DEFINE_CLASS_NAME("callstack_tracker"); bool push_frame(const char *class_name, const char *func, const char *file, int line); @@ -142,12 +141,18 @@ void update_current_stack_frame_line_number(int line); //!< sets the line number for the current frame in the global stack trace. #else // ENABLE_CALLSTACK_TRACKING - // bogus replacements for most commonly used callstack tracking support. + /* + bogus replacements for the most commonly used callstack tracking support. + these are necessary because we don't want this enabled in all scenarios, + and when we want the callstack tracking disabled, it must have near zero + runtime cost. + */ + inline void no_op() { /* do nothing. */ } #define frame_tracking_instance - #define __trail_of_function(p1, p2, p3, p4, p5) if (func) {} + #define __trail_of_function(p1, p2, p3, p4, p5) no_op(); // the above actually trades on the name of the object we'd normally // define. it must match the object name in the FUNCDEF macro. - #define update_current_stack_frame_line_number(line) + inline void update_current_stack_frame_line_number(int line) { /* more nothing. */ } #endif // ENABLE_CALLSTACK_TRACKING } //namespace. diff --git a/nucleus/library/application/memory_checker.cpp b/nucleus/library/application/memory_checker.cpp index 2917b6db..85d46dcc 100644 --- a/nucleus/library/application/memory_checker.cpp +++ b/nucleus/library/application/memory_checker.cpp @@ -55,6 +55,8 @@ const int RESERVED_AREA = 1000; //#define DEBUG_MEMORY_CHECKER // uncomment for super noisy version. +namespace application { + ////////////// // define the replacement new and delete operators. @@ -408,7 +410,7 @@ char *memory_checker::text_form(bool show_outstanding) ////////////// -#endif // enable memory hook - +} // namespace. +#endif // enable memory hook diff --git a/nucleus/library/basis/enhance_cpp.h b/nucleus/library/basis/enhance_cpp.h index 98589ec7..d66d2a5b 100644 --- a/nucleus/library/basis/enhance_cpp.h +++ b/nucleus/library/basis/enhance_cpp.h @@ -15,6 +15,7 @@ * Please send any updates to: fred@gruntose.com * \*****************************************************************************/ +#include #include namespace basis { @@ -27,10 +28,6 @@ namespace basis { cannot get its own name, and other really helpful features. */ -//hmmm: temporary to hide missing code. -#define frame_tracking_instance -#define __trail_of_function(a, b, c, d, e) - class enhance_cpp : public virtual root_object { public: @@ -56,8 +53,8 @@ public: time the stack will no longer show it as active. */ #define FUNCDEF(func_in) \ const char *func = (const char *)func_in; \ - frame_tracking_instance __trail_of_function(static_class_name(), func, \ - __FILE__, __LINE__, true) + application::frame_tracking_instance __trail_of_function(static_class_name(), func, \ + __FILE__, __LINE__, true); ////////////// @@ -71,7 +68,7 @@ public: that object (the macro "func" must be defined with that name). */ #define FUNCTION(func) BASE_FUNCTION(func); \ function_name += ": "; \ - update_current_stack_frame_line_number(__LINE__) + application::update_current_stack_frame_line_number(__LINE__) //! A macro used within the INSTANCE_FUNCTION macro. #define BASE_INSTANCE_FUNCTION(func) astring just_function = astring(func); \ @@ -83,7 +80,7 @@ public: information about the class. */ #define INSTANCE_FUNCTION(func) BASE_INSTANCE_FUNCTION(func); \ function_name += ": "; \ - update_current_stack_frame_line_number(__LINE__) + application::update_current_stack_frame_line_number(__LINE__) ////////////// diff --git a/nucleus/library/configuration/application_configuration.cpp b/nucleus/library/configuration/application_configuration.cpp index 89670bce..0ebd6e5d 100644 --- a/nucleus/library/configuration/application_configuration.cpp +++ b/nucleus/library/configuration/application_configuration.cpp @@ -15,6 +15,7 @@ #include #include +//#include #include #include #include diff --git a/nucleus/library/configuration/application_configuration.h b/nucleus/library/configuration/application_configuration.h index 293f0fdb..371e7bd4 100644 --- a/nucleus/library/configuration/application_configuration.h +++ b/nucleus/library/configuration/application_configuration.h @@ -26,6 +26,8 @@ class application_configuration : public virtual basis::root_object public: virtual ~application_configuration() {} + DEFINE_CLASS_NAME("application_configuration"); + // these methods are mainly about the application itself. static basis::astring application_name(); diff --git a/nucleus/library/loggers/logging_macros.h b/nucleus/library/loggers/logging_macros.h index 31547a41..72a2a5a4 100644 --- a/nucleus/library/loggers/logging_macros.h +++ b/nucleus/library/loggers/logging_macros.h @@ -21,12 +21,13 @@ of these to yield a simpler macro name per project, such as PRINT or LOG. */ +#include #include #include #include ///hmmm: very temporary until the call stack tracking is available again. -#define update_current_stack_frame_line_number(x) +////#define update_current_stack_frame_line_number(x) //! Logs a string "to_log" on "the_logger" using the "filter". /*! The filter is checked before the string is allowed to come into @@ -58,7 +59,7 @@ out anyway. */ //! Class specific logging method that uses a filter. /* These add a class and function name to the log entry. */ #define CLASS_FILTER_LOG(the_logger, to_log, filter) { \ - update_current_stack_frame_line_number(__LINE__); \ + application::update_current_stack_frame_line_number(__LINE__); \ if (the_logger.member(filter)) { \ astring temp_log = to_log; \ if (temp_log.length()) { \ @@ -70,7 +71,7 @@ out anyway. */ } \ the_logger.log(temp_log, filter); \ } \ - update_current_stack_frame_line_number(__LINE__); \ + application::update_current_stack_frame_line_number(__LINE__); \ } //! Class specific logging method that always prints. #define CLASS_EMERGENCY_LOG(the_logger, to_log) \ @@ -80,7 +81,7 @@ out anyway. */ /*! This use the instance name of the object, which can include more information than the simple class name. */ #define INSTANCE_FILTER_LOG(the_logger, to_log, filter) { \ - update_current_stack_frame_line_number(__LINE__); \ + application::update_current_stack_frame_line_number(__LINE__); \ if (the_logger.member(filter)) { \ astring temp_log = to_log; \ if (temp_log.length()) { \ @@ -91,7 +92,7 @@ information than the simple class name. */ temp_log += "]"; \ } \ the_logger.log(temp_log, filter); \ - update_current_stack_frame_line_number(__LINE__); \ + application::update_current_stack_frame_line_number(__LINE__); \ } \ } //! Logs with class instance info, but this always prints. diff --git a/nucleus/library/nodes/path.cpp b/nucleus/library/nodes/path.cpp index 4a2c0c90..39fe0512 100644 --- a/nucleus/library/nodes/path.cpp +++ b/nucleus/library/nodes/path.cpp @@ -86,7 +86,7 @@ outcome path::push(int index) bool path::generate_path(node *to_locate, path &to_follow) const { - FUNCDEF("generate_path") + FUNCDEF("generate_path"); if (to_locate || to_follow.current()) {} LOG("hmmm: path::generate_path is not implemented."); diff --git a/nucleus/library/nodes/symbol_tree.cpp b/nucleus/library/nodes/symbol_tree.cpp index ba5c33f9..afcb0225 100644 --- a/nucleus/library/nodes/symbol_tree.cpp +++ b/nucleus/library/nodes/symbol_tree.cpp @@ -54,7 +54,7 @@ symbol_tree::symbol_tree(const astring &node_name, int estimated_elements) _associations(new symbol_tree_associations(estimated_elements)), _name(new astring(node_name)) { - FUNCDEF("constructor") + FUNCDEF("constructor"); } symbol_tree::~symbol_tree() diff --git a/nucleus/library/structures/static_memory_gremlin.cpp b/nucleus/library/structures/static_memory_gremlin.cpp index 20c08179..fc95d75f 100644 --- a/nucleus/library/structures/static_memory_gremlin.cpp +++ b/nucleus/library/structures/static_memory_gremlin.cpp @@ -15,13 +15,47 @@ #include #include +#include //temp! needed for fake continuable error etc #include #include +using namespace application; using namespace basis; +/* no. +namespace application { + +//! the single instance of callstack_tracker. +/ *! this is also an ultra low-level object, although it's not as far down +as the memory checker. it can allocate c++ objects and that kind of thing +just fine. the object must be stored here rather than in the static basis +library due to issues in windows dlls. +NOTE: this is also not thread safe; it must be initialized before any threads +have started. * / + +//hmmm: why is this here? because it needs to interact with the progwide memories? +callstack_tracker &program_wide_stack_trace() +{ + static callstack_tracker *_hidden_trace = NULL_POINTER; + if (!_hidden_trace) { +#ifdef ENABLE_MEMORY_HOOK + program_wide_memories().disable(); + // we don't want infinite loops tracking the call stack during this + // object's construction. +#endif + _hidden_trace = new callstack_tracker; +#ifdef ENABLE_MEMORY_HOOK + program_wide_memories().enable(); +#endif + } + return *_hidden_trace; +} + +} //namespace. +*/ + namespace structures { //#define DEBUG_STATIC_MEMORY_GREMLIN @@ -219,7 +253,7 @@ static_memory_gremlin &static_memory_gremlin::__hoople_globals() #endif #ifdef ENABLE_CALLSTACK_TRACKING - program_wide_stack_trace().full_trace_size(); + application::program_wide_stack_trace().full_trace_size(); // invoke now to get callback tracking instantiated. #endif FUNCDEF("HOOPLE_GLOBALS remainder"); diff --git a/nucleus/library/tests_application/makefile b/nucleus/library/tests_application/makefile index ab587320..cdb8efb8 100644 --- a/nucleus/library/tests_application/makefile +++ b/nucleus/library/tests_application/makefile @@ -4,8 +4,8 @@ include cpp/variables.def PROJECT = tests_application TYPE = test -TARGETS = test_break_signal.exe test_command_line.exe test_path_configuration.exe \ - test_registry_configurator.exe +TARGETS = test_break_signal.exe test_callstack_tracker.exe test_command_line.exe \ + test_path_configuration.exe test_registry_configurator.exe DEFINITIONS += USE_FEISTY_MEOW_DLLS LOCAL_LIBS_USED = unit_test application configuration filesystem loggers \ mathematics nodes processes structures textual timely structures basis diff --git a/nucleus/library/tests_application/test_callstack_tracker.cpp b/nucleus/library/tests_application/test_callstack_tracker.cpp new file mode 100644 index 00000000..9199e831 --- /dev/null +++ b/nucleus/library/tests_application/test_callstack_tracker.cpp @@ -0,0 +1,99 @@ +/*****************************************************************************\ +* +* Name : test_callstack_tracker +* Author : Chris Koeritz +* +* Purpose: +* +* Puts the callstack tracking code through its paces, a bit. +* +******************************************************************************* +* Copyright (c) 1992-$now By Author. This program is free software; you can * +* redistribute it and/or modify it under the terms of the GNU General Public * +* License as published by the Free Software Foundation; either version 2 of * +* the License or (at your option) any later version. This is online at: * +* http://www.fsf.org/copyleft/gpl.html * +* Please send any updates to: fred@gruntose.com * +\*****************************************************************************/ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace application; +using namespace basis; +using namespace filesystem; +using namespace loggers; +using namespace structures; +using namespace unit_test; + +#define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger::get(), s) + +class test_callstack_tracker : virtual public unit_base, virtual public application_shell +{ +public: + test_callstack_tracker() : application_shell() {} + DEFINE_CLASS_NAME("test_callstack_tracker"); + // our test suite... + int run_filestack_simple(); + int run_filestack_middling(); + int run_filestack_complex(); + int execute(); +}; + +int test_callstack_tracker::run_filestack_simple() +{ + #ifdef ENABLE_CALLSTACK_TRACKING +//just show this stack. +//return an error if any problem. + #endif + return 0; +} + +int test_callstack_tracker::run_filestack_middling() +{ + #ifdef ENABLE_CALLSTACK_TRACKING +//show a couple calls in. +//return an error if any problem. + #endif + return 0; +} + +int test_callstack_tracker::run_filestack_complex() +{ + #ifdef ENABLE_CALLSTACK_TRACKING +//do something recursive and show an elaborate stack +//return an error if any problem. + #endif + return 0; +} + +int test_callstack_tracker::execute() +{ + FUNCDEF("execute"); + + int ret = run_filestack_simple(); + if (ret) return ret; + ret = run_filestack_middling(); + if (ret) return ret; + ret = run_filestack_complex(); + if (ret) return ret; + + critical_events::alert_message(astring(class_name()) + ": works for those functions tested."); + + return final_report(); +} + +HOOPLE_MAIN(test_callstack_tracker, ) + diff --git a/nucleus/library/tests_basis/checkup.cpp b/nucleus/library/tests_basis/checkup.cpp index cf0a53bb..46f66501 100644 --- a/nucleus/library/tests_basis/checkup.cpp +++ b/nucleus/library/tests_basis/checkup.cpp @@ -13,6 +13,7 @@ #include "checkup.h" #include +#include #include using namespace basis; @@ -24,7 +25,7 @@ namespace system_checkup { #undef UNIT_BASE_THIS_OBJECT #define UNIT_BASE_THIS_OBJECT testing #undef static_class_name -#define static_class_name() astring("system_checkup") +#define static_class_name() "system_checkup" bool check_system_characteristics(unit_base &testing) { diff --git a/nucleus/library/timely/earth_time.cpp b/nucleus/library/timely/earth_time.cpp index 4aa501f5..7b00ae96 100644 --- a/nucleus/library/timely/earth_time.cpp +++ b/nucleus/library/timely/earth_time.cpp @@ -22,7 +22,7 @@ #include #include #if defined(__WIN32__) || defined(__UNIX__) -// #include + #include #endif #include @@ -323,6 +323,8 @@ time_number time_locus::normalize(time_locus &to_fix) ////////////// +#define static_class_name() "time_locus" + time_locus convert(time_number seconds, time_number useconds, const tm &cal_values) { @@ -351,7 +353,7 @@ time_locus convert(time_number seconds, time_number useconds, time_locus now() { - FUNCDEF("now") + FUNCDEF("now"); timeval currtime; int okay = gettimeofday(&currtime, NULL_POINTER); if (okay != 0) { @@ -368,7 +370,7 @@ time_locus now() time_locus greenwich_now() { - FUNCDEF("greenwich_now") + FUNCDEF("greenwich_now"); timeval currtime; int okay = gettimeofday(&currtime, NULL_POINTER); if (okay != 0) { @@ -445,5 +447,7 @@ const char *short_month_name(months to_name) } } +#undef static_class_name + } // namespace. diff --git a/nucleus/library/timely/earth_time.h b/nucleus/library/timely/earth_time.h index 74eaec7c..d0ba036e 100644 --- a/nucleus/library/timely/earth_time.h +++ b/nucleus/library/timely/earth_time.h @@ -90,6 +90,8 @@ namespace timely { time_number millisecond; //!< The number of milliseconds elapsed in this second. time_number microsecond; //!< Number of microseconds elapsed in this millisecond. + DEFINE_CLASS_NAME("clock_time"); + //! Constructs a clock_time object given all the parts. clock_time(time_number h = 0, time_number m = 0, time_number s = 0, time_number ms = 0, time_number us = 0) : hour(h), minute(m), second(s), millisecond(ms), @@ -143,6 +145,8 @@ namespace timely { days day_of_week; //!< The day of the week. time_number day_of_year; //!< Numerical day, where January 1st is equal to zero. + DEFINE_CLASS_NAME("day_in_year"); + int packed_size() const { return 4 * structures::PACKED_SIZE_INT64; } //! Constructs a representation of the day specified. diff --git a/nucleus/tools/clam_tools/value_tagger.cpp b/nucleus/tools/clam_tools/value_tagger.cpp index d90dac3e..90b6a053 100644 --- a/nucleus/tools/clam_tools/value_tagger.cpp +++ b/nucleus/tools/clam_tools/value_tagger.cpp @@ -1004,5 +1004,9 @@ HOOPLE_MAIN(value_tagger, ) #include #include #include + +//added manually since buildor_gen_deps is hosed as of 2026-02-09 (or earlier, since i didn't notice). +#include + #endif // __BUILD_STATIC_APPLICATION__ diff --git a/nucleus/tools/clam_tools/version_stamper.cpp b/nucleus/tools/clam_tools/version_stamper.cpp index 3313906d..481abc2f 100644 --- a/nucleus/tools/clam_tools/version_stamper.cpp +++ b/nucleus/tools/clam_tools/version_stamper.cpp @@ -132,5 +132,9 @@ HOOPLE_MAIN(version_stamper, ) #include #include #include + +//added manually since buildor_gen_deps is hosed as of 2026-02-09 (or earlier, since i didn't notice). +#include + #endif // __BUILD_STATIC_APPLICATION__ diff --git a/nucleus/tools/clam_tools/vsts_version_fixer.cpp b/nucleus/tools/clam_tools/vsts_version_fixer.cpp index 3beb8779..39e672c7 100644 --- a/nucleus/tools/clam_tools/vsts_version_fixer.cpp +++ b/nucleus/tools/clam_tools/vsts_version_fixer.cpp @@ -364,5 +364,9 @@ LOG(astring("chose source dir as ") + repo_source); #include #include #include + +//added manually since buildor_gen_deps is hosed as of 2026-02-09 (or earlier, since i didn't notice). +#include + #endif // __BUILD_STATIC_APPLICATION__ diff --git a/nucleus/tools/clam_tools/write_build_config.cpp b/nucleus/tools/clam_tools/write_build_config.cpp index 6713ed63..9b29a289 100644 --- a/nucleus/tools/clam_tools/write_build_config.cpp +++ b/nucleus/tools/clam_tools/write_build_config.cpp @@ -426,5 +426,9 @@ HOOPLE_MAIN(write_build_config, ) #include #include #include + +//added manually since buildor_gen_deps is hosed as of 2026-02-09 (or earlier, since i didn't notice). +#include + #endif // __BUILD_STATIC_APPLICATION__ diff --git a/nucleus/tools/dependency_tool/cppsetup.cpp b/nucleus/tools/dependency_tool/cppsetup.cpp index dc404113..e3ab1057 100644 --- a/nucleus/tools/dependency_tool/cppsetup.cpp +++ b/nucleus/tools/dependency_tool/cppsetup.cpp @@ -66,10 +66,10 @@ extern char slotab[]; struct filepointer *currentfile; inclist *currentinc; -int cppsetup(register char *line, register struct filepointer *filep, - register inclist *inc) +int cppsetup(char *line, struct filepointer *filep, + inclist *inc) { - register char *p, savec; + char *p, savec; static bool setupdone = false; bool value; @@ -120,7 +120,7 @@ int pperror(int tag, int x0, int x1, int x2, int x3, int x4) } -int yyerror(register char *s) +int yyerror(char *s) { fatalerr("Fatal error: %s\n", s); } @@ -204,8 +204,8 @@ static int _my_eval_variable(IfParser *ip, const char *var, int len) } -int cppsetup(register char *line, register struct filepointer *filep, - register inclist *inc) +int cppsetup(char *line, struct filepointer *filep, + inclist *inc) { IfParser ip; struct _parse_data pd; diff --git a/nucleus/tools/dependency_tool/def.h b/nucleus/tools/dependency_tool/def.h index de4e4189..aa2fb426 100644 --- a/nucleus/tools/dependency_tool/def.h +++ b/nucleus/tools/dependency_tool/def.h @@ -139,28 +139,28 @@ symtab *slookup(); symtab *isdefined(); symtab *fdefined(); filepointer *getfile(); -inclist *newinclude(register char *, register char *); +inclist *newinclude(char *, char *); inclist *inc_path(); */ // cppsetup.cpp: -int cppsetup(register char *line, register filepointer *filep, - register inclist *inc); +int cppsetup(char *line, filepointer *filep, + inclist *inc); // include.cpp -inclist *newinclude(register char *newfile, register char *incstring); +inclist *newinclude(char *newfile, char *incstring); void inc_clean(); -inclist *inc_path(register char *file, register char *include, bool dot, +inclist *inc_path(char *file, char *include, bool dot, bool &failure_okay); -void included_by(register inclist *ip, register inclist *newfile); +void included_by(inclist *ip, inclist *newfile); // main.cpp: -char *base_name(register char *file); -char *copy(register char *str); +char *base_name(char *file); +char *copy(char *str); filepointer *getfile(char *file); void freefile(filepointer *fp); -char *getline(register filepointer *filep); -int match(register const char *str, register const char **list); +char *getline(filepointer *filep); +int match(const char *str, const char **list); void redirect(char *line, char *makefile); #if NeedVarargsPrototypes void fatalerr(const char *, ...); @@ -171,25 +171,25 @@ void redirect(char *line, char *makefile); // parse.cpp: void define(char *def, inclist *file); void define2(char *name, char *val, inclist *file); -int deftype(register char *line, register filepointer *filep, - register inclist *file_red, register inclist *file, +int deftype(char *line, filepointer *filep, + inclist *file_red, inclist *file, int parse_it); -symtab *fdefined(register char *symbol, inclist *file, inclist **srcfile); +symtab *fdefined(char *symbol, inclist *file, inclist **srcfile); int find_includes(filepointer *filep, inclist *file, inclist *file_red, int recursion, bool failOK); -int gobble(register filepointer *filep, inclist *file, +int gobble(filepointer *filep, inclist *file, inclist *file_red); -symtab *isdefined(register char *symbol, inclist *file, +symtab *isdefined(char *symbol, inclist *file, inclist **srcfile); -symtab *slookup(register char *symbol, register inclist *file); -void undefine(char *symbol, register inclist *file); -int zero_value(register char *exp, register filepointer *filep, - register inclist *file_red); +symtab *slookup(char *symbol, inclist *file); +void undefine(char *symbol, inclist *file); +int zero_value(char *exp, filepointer *filep, + inclist *file_red); // pr.cpp: void add_include(filepointer *filep, inclist *file, inclist *file_red, char *include, bool dot, bool failOK); -void pr(register inclist *ip, char *file, char *base, bool rc_file); -void recursive_pr_include(register inclist *head, register char *file, - register char *base); +void pr(inclist *ip, char *file, char *base, bool rc_file); +void recursive_pr_include(inclist *head, char *file, + char *base); diff --git a/nucleus/tools/dependency_tool/include.cpp b/nucleus/tools/dependency_tool/include.cpp index 631027b7..d7df1978 100644 --- a/nucleus/tools/dependency_tool/include.cpp +++ b/nucleus/tools/dependency_tool/include.cpp @@ -50,24 +50,24 @@ extern bool warn_multiple; // forward. void remove_dotdot(char *path); -int isdot(register char *p); -int isdotdot(register char *p); -int issymbolic(register char *dir, register char *component); -void included_by(register inclist *ip, register inclist *newfile); +int isdot(char *p); +int isdotdot(char *p); +int issymbolic(char *dir, char *component); +void included_by(inclist *ip, inclist *newfile); -inclist *inc_path(register char *file, register char *include, bool dot, +inclist *inc_path(char *file, char *include, bool dot, bool &failure_okay) { static char path[ BUFSIZ ]; - register char **pp, *p; - register inclist *ip; + char **pp, *p; + inclist *ip; struct stat st; bool found = false; //fprintf(stderr, "file=%s include=%s\n", file, include); const size_t inclen = strlen(include); if (inclen >= 4) { - register char *cpp_point = include + inclen - 4; + char *cpp_point = include + inclen - 4; if (!strcasecmp(".cpp", cpp_point)) { // this is a CPP file include, which we skip. //fprintf(stderr, "!found match at point: %s\n", cpp_point); @@ -134,7 +134,7 @@ inclist *inc_path(register char *file, register char *include, bool dot, sprintf(path, "%s/%s", *pp, include); remove_dotdot(path); if (stat(path, &st) == 0) { - register char **pp2; + char **pp2; bool exclude_it = false; for (pp2 = excludedirs; *pp2; pp2++) { ////////fprintf(stderr, "comparing %s with %s\n", *pp, *pp2); @@ -170,7 +170,7 @@ inclist *inc_path(register char *file, register char *include, bool dot, */ void remove_dotdot(char *path) { - register char *end, *from, *to, **cp; + char *end, *from, *to, **cp; char *components[ MAXFILES ], newpath[ BUFSIZ ]; bool component_copied; @@ -235,21 +235,21 @@ void remove_dotdot(char *path) strcpy(path, newpath); } -int isdot(register char *p) +int isdot(char *p) { if(p && *p++ == '.' && *p++ == '\0') return(true); return(false); } -int isdotdot(register char *p) +int isdotdot(char *p) { if(p && *p++ == '.' && *p++ == '.' && *p++ == '\0') return(true); return(false); } -int issymbolic(register char *dir, register char *component) +int issymbolic(char *dir, char *component) { #ifdef S_IFLNK struct stat st; @@ -273,9 +273,9 @@ int issymbolic(register char *dir, register char *component) /* * Add an include file to the list of those included by 'file'. */ -inclist *newinclude(register char *newfile, register char *incstring) +inclist *newinclude(char *newfile, char *incstring) { - register inclist *ip; + inclist *ip; /* * First, put this file on the global list of include files. @@ -293,9 +293,9 @@ inclist *newinclude(register char *newfile, register char *incstring) return(ip); } -void included_by(register inclist *ip, register inclist *newfile) +void included_by(inclist *ip, inclist *newfile) { - register int i; + int i; if (ip == NULL) return; @@ -339,7 +339,7 @@ void included_by(register inclist *ip, register inclist *newfile) void inc_clean() { - register inclist *ip; + inclist *ip; for (ip = inc_list; ip < inclistp; ip++) { ip->i_marked = false; diff --git a/nucleus/tools/dependency_tool/makedep.cpp b/nucleus/tools/dependency_tool/makedep.cpp index f85e219a..0fe74c09 100644 --- a/nucleus/tools/dependency_tool/makedep.cpp +++ b/nucleus/tools/dependency_tool/makedep.cpp @@ -177,11 +177,11 @@ printf((istring("added ") + curr + "\n").s()); int main(int argc, char **argv) { - register char **fp = filelist; - register char **incp = includedirs; - register char **excp = excludedirs; - register char *p; - register struct inclist *ip; + char **fp = filelist; + char **incp = includedirs; + char **excp = excludedirs; + char *p; + struct inclist *ip; char *makefile = NULL; struct filepointer *filecontent; struct symtab *psymp = predefs; @@ -517,7 +517,7 @@ int main(int argc, char **argv) struct filepointer *getfile(char *file) { - register int fd; + int fd; struct filepointer *content; struct stat st; @@ -551,17 +551,17 @@ void freefile(struct filepointer *fp) free(fp); } -char *copy(register char *str) +char *copy(char *str) { - register char *p = (char *)malloc(strlen(str) + 1); + char *p = (char *)malloc(strlen(str) + 1); strcpy(p, str); return(p); } -int match(register const char *str, register const char **list) +int match(const char *str, const char **list) { - register int i; + int i; for (i=0; *list; i++, list++) if (strcmp(str, *list) == 0) @@ -573,12 +573,12 @@ int match(register const char *str, register const char **list) * Get the next line. We only return lines beginning with '#' since that * is all this program is ever interested in. */ -char *getline(register struct filepointer *filep) +char *getline(struct filepointer *filep) { - register char *p, /* walking pointer */ + char *p, /* walking pointer */ *eof, /* end of file pointer */ *bol; /* beginning of line pointer */ - register int lineno; /* line number */ + int lineno; /* line number */ eof = filep->f_end; //// if (p >= eof) return NULL; @@ -629,7 +629,7 @@ if (bol > p) fatalerr("somehow bol got ahead of p."); ////fprintf(stderr, "%s: %s\n", filep->f_name, bol); ////fflush(stderr); if (*bol == '#') { - register char *cp; + char *cp; /* punt lines with just # (yacc generated) */ for (cp = bol+1; *cp && (*cp == ' ' || *cp == '\t'); cp++) {} if (*cp) { p++; goto done; } @@ -650,9 +650,9 @@ done: * Strip the file name down to what we want to see in the Makefile. * It will have objprefix and objsuffix around it. */ -char *base_name(register char *file) +char *base_name(char *file) { - register char *p; + char *p; file = copy(file); for(p=file+strlen(file); p>file && *p != '.'; p--) ; diff --git a/nucleus/tools/dependency_tool/parse.cpp b/nucleus/tools/dependency_tool/parse.cpp index bc8537a8..f70daed9 100644 --- a/nucleus/tools/dependency_tool/parse.cpp +++ b/nucleus/tools/dependency_tool/parse.cpp @@ -39,8 +39,8 @@ extern inclist maininclist; int find_includes(struct filepointer *filep, inclist *file, inclist *file_red, int recursion, bool failOK) { - register char *line; - register int type; + char *line; + int type; bool recfailOK; while ((line = getline(filep))) { @@ -162,11 +162,11 @@ int find_includes(struct filepointer *filep, inclist *file, inclist *file_red, i return(-1); } -int gobble(register struct filepointer *filep, inclist *file, +int gobble(struct filepointer *filep, inclist *file, inclist *file_red) { - register char *line; - register int type; + char *line; + int type; while ((line = getline(filep))) { switch(type = deftype(line, filep, file_red, file, false)) { @@ -215,13 +215,13 @@ int gobble(register struct filepointer *filep, inclist *file, /* * Decide what type of # directive this line is. */ -int deftype(register char *line, register struct filepointer *filep, - register inclist *file_red, register inclist *file, +int deftype(char *line, struct filepointer *filep, + inclist *file_red, inclist *file, int parse_it) { - register char *p; + char *p; char *directive, savechar; - register int ret; + int ret; /* * Parse the directive... @@ -359,10 +359,10 @@ int deftype(register char *line, register struct filepointer *filep, return(ret); } -symtab *isdefined(register char *symbol, inclist *file, +symtab *isdefined(char *symbol, inclist *file, inclist **srcfile) { - register struct symtab *val; + struct symtab *val; if ((val = slookup(symbol, &maininclist))) { debug(1,("%s defined on command line\n", symbol)); @@ -375,11 +375,11 @@ symtab *isdefined(register char *symbol, inclist *file, return(NULL); } -struct symtab *fdefined(register char *symbol, inclist *file, inclist **srcfile) +struct symtab *fdefined(char *symbol, inclist *file, inclist **srcfile) { - register inclist **ip; - register struct symtab *val; - register int i; + inclist **ip; + struct symtab *val; + int i; static int recurse_lvl = 0; if (file->i_defchecked) @@ -404,8 +404,8 @@ struct symtab *fdefined(register char *symbol, inclist *file, inclist **srcfil /* * Return type based on if the #if expression evaluates to 0 */ -int zero_value(register char *exp, register struct filepointer *filep, - register inclist *file_red) +int zero_value(char *exp, struct filepointer *filep, + inclist *file_red) { if (cppsetup(exp, filep, file_red)) return(IFFALSE); @@ -434,7 +434,7 @@ void define(char *def, inclist *file) void define2(char *name, char *val, inclist *file) { int first, last, below; - register struct symtab *sp = NULL, *dest; + struct symtab *sp = NULL, *dest; /* Make space if it's needed */ if (file->i_defs == NULL) @@ -457,9 +457,9 @@ void define2(char *name, char *val, inclist *file) while (last >= first) { /* Fast inline binary search */ - register char *s1; - register char *s2; - register int middle = (first + last) / 2; + char *s1; + char *s2; + int middle = (first + last) / 2; /* Fast inline strchr() */ s1 = name; @@ -507,17 +507,17 @@ void define2(char *name, char *val, inclist *file) sp->s_value = copy(val); } -struct symtab *slookup(register char *symbol, register inclist *file) +struct symtab *slookup(char *symbol, inclist *file) { - register int first = 0; - register int last = file->i_ndefs - 1; + int first = 0; + int last = file->i_ndefs - 1; if (file) while (last >= first) { /* Fast inline binary search */ - register char *s1; - register char *s2; - register int middle = (first + last) / 2; + char *s1; + char *s2; + int middle = (first + last) / 2; /* Fast inline strchr() */ s1 = symbol; @@ -545,9 +545,9 @@ struct symtab *slookup(register char *symbol, register inclist *file) return(NULL); } -void undefine(char *symbol, register inclist *file) +void undefine(char *symbol, inclist *file) { - register struct symtab *ptr; + struct symtab *ptr; inclist *srcfile; while ((ptr = isdefined(symbol, file, &srcfile)) != NULL) { diff --git a/nucleus/tools/dependency_tool/pr.cpp b/nucleus/tools/dependency_tool/pr.cpp index 6c414ef7..a4bca059 100644 --- a/nucleus/tools/dependency_tool/pr.cpp +++ b/nucleus/tools/dependency_tool/pr.cpp @@ -44,8 +44,8 @@ extern bool show_where_not; void add_include(filepointer *filep, inclist *file, inclist *file_red, char *include, bool dot, bool failOK) { - register struct inclist *newfile; - register struct filepointer *content; + struct inclist *newfile; + struct filepointer *content; /* * First decide what the pathname of this include file really is. @@ -77,10 +77,10 @@ fatalerr("cannot find include file \"%s\"\n", include); } } -void recursive_pr_include(register struct inclist *head, register char *file, - register char *base) +void recursive_pr_include(struct inclist *head, char *file, + char *base) { - register int i; + int i; if (head->i_marked) return; @@ -95,11 +95,11 @@ void recursive_pr_include(register struct inclist *head, register char *file, recursive_pr_include(head->i_list[ i ], file, base); } -void pr(register struct inclist *ip, char *file, char *base, bool rc_file) +void pr(struct inclist *ip, char *file, char *base, bool rc_file) { static char *lastfile; static int current_len; - register int len, i; + int len, i; char buf[ BUFSIZ ]; printed = true; diff --git a/scripts/clam/cpp/buildor_gen_deps.sh b/scripts/clam/cpp/buildor_gen_deps.sh index f89eef01..80a6be38 100644 --- a/scripts/clam/cpp/buildor_gen_deps.sh +++ b/scripts/clam/cpp/buildor_gen_deps.sh @@ -444,7 +444,7 @@ function write_new_version { # throw out any items that are in the same directory we started in. if [ "$prohibited_directory" == "$(dirname $line_please)" ]; then -#echo "skipping prohibited: $line_please" +echo "skipping prohibited: $line_please" continue fi @@ -452,13 +452,13 @@ function write_new_version { local chewed_line=$(echo $line_please | sed -e 's/.*[\\\/]\(.*\)[\\\/]\(.*\)$/\1\/\2/') if [ ! -z "$(echo $chewed_line | sed -n -e 's/\.h$/yow/p')" ]; then -#echo skipping header file: $chewed_line +echo skipping header file: $chewed_line continue fi local new_include=" #include <$chewed_line>" echo "$new_include" >>"$pending_deps" -#echo adding "$new_include" +echo adding "$new_include" done sort "$pending_deps" >>"$replacement_file"