From: Bruno Haible Date: Tue, 25 Apr 2006 12:01:00 +0000 (+0000) Subject: Sort the #include directives more carefully. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=607547cc5ced7ad6c5c8a59ceb5635d9546b59ff;p=pspp Sort the #include directives more carefully. --- diff --git a/ChangeLog b/ChangeLog index 8bbd7526c1..05100df596 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-04-25 Bruno Haible + + * gnulib-tool (func_import): Output the include directives in three + blocks, sorted separately. + Reported by Ben Pfaff . + 2006-04-23 Bruno Haible * modules/copy-file: Depend on unistd. diff --git a/gnulib-tool b/gnulib-tool index b7a6dea7b6..fbdd5b6a68 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -22,7 +22,7 @@ progname=$0 package=gnulib -cvsdatestamp='$Date: 2006-04-24 11:35:07 $' +cvsdatestamp='$Date: 2006-04-25 12:01:00 $' last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'` version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'` @@ -1453,9 +1453,30 @@ func_import () echo "Finished." echo echo "You may need to add #include directives for the following .h files." - for module in $modules; do - func_get_include_directive "$module" - done | LC_ALL=C sort -u | sed -e '/^$/d;' -e 's/^/ /' + ( + # First the #include <...> directives without #ifs, sorted for convenience. + for module in $modules; do + if func_get_include_directive "$module" | grep '^#if' >/dev/null; then + : + else + func_get_include_directive "$module" | grep -v 'include "' + fi + done | LC_ALL=C sort -u + # Then the #include "..." directives without #ifs, sorted for convenience. + for module in $modules; do + if func_get_include_directive "$module" | grep '^#if' >/dev/null; then + : + else + func_get_include_directive "$module" | grep 'include "' + fi + done | LC_ALL=C sort -u + # Then the #include directives that are surrounded by #ifs. Not sorted. + for module in $modules; do + if func_get_include_directive "$module" | grep '^#if' >/dev/null; then + func_get_include_directive "$module" + fi + done + ) | sed -e '/^$/d;' -e 's/^/ /' echo echo "Don't forget to" echo " - add \"$sourcebase/Makefile\" to AC_CONFIG_FILES in $configure_ac,"