# HG changeset patch # User Rob Landley # Date 1393207866 21600 # Node ID c86b1579c383280e5355cd9d8ad5cdbfe497d551 # Parent 22739b6d5a0e693086cad5912fd12d63fdec3385 CLEANUP transitions require all the generated/flags.h stanzas always be present (even for commands disabled in the config) to avoid undefined symbol errors referencing FLAG_ macros. diff -r 22739b6d5a0e -r c86b1579c383 scripts/make.sh --- a/scripts/make.sh Sat Feb 22 08:02:09 2014 -0600 +++ b/scripts/make.sh Sun Feb 23 20:11:06 2014 -0600 @@ -70,6 +70,11 @@ echo -n "generated/flags.h " +# Process config.h and newtoys.h to generate FLAG_x macros. Note we must +# always #define the relevant macro, even when it's disabled, because we +# allow multiple NEWTOY() in the same C file. (When disabled the FLAG is 0, +# so flags&0 becomes a constant 0 allowing dead code elimination.) + # Parse files through C preprocessor twice, once to get flags for current # .config and once to get flags for allyesconfig for I in A B @@ -98,8 +103,10 @@ # Sort resulting line pairs and glue them together into triplets of # command "flags" "allflags" # to feed into mkflags C program that outputs actual flag macros +# If no pair (because command's disabled in config), use " " for flags +# so allflags can define the appropriate zero macros. -done | sort | sed -n 's/ A / /;t skip;d;:skip;h;n;s/[^ ]* B //;H;g;s/\n/ /;p' |\ +done | sort | sed -n 's/ A / /;t pair;h;s/\([^ ]*\).*/\1 " "/;x;b single;:pair;h;n;:single;s/[^ ]* B //;H;g;s/\n/ /;p' |\ generated/mkflags > generated/flags.h || exit 1 # Extract global structure definitions and flag definitions from toys/*/*.c