Ben Pfaff wrote: > gnulib-tool appears to blindly sort the list of #include > directives it prints. When the list contains #if...#endif, that > makes the output funny, e.g.: > > You may need to add #include directives for the following .h files. > #endif > #if HAVE_MBRTOWC > #if HAVE_WCHAR_H && HAVE_WCTYPE_H > #include "c-ctype.h" > #include "c-strtod.h" > #include "error.h" > [...] > > Of course, it's harmless, but it looks funny.
I'm committing this fix, that additionally will sort all the #include <...> before all the #include "..." (as is common gnulib style). Bruno 2006-04-25 Bruno Haible <[EMAIL PROTECTED]> * gnulib-tool (func_import): Output the include directives in three blocks, sorted separately. Reported by Ben Pfaff <[EMAIL PROTECTED]>. *** gnulib-tool 24 Apr 2006 11:35:07 -0000 1.109 --- gnulib-tool 25 Apr 2006 11:58:15 -0000 *************** *** 1453,1461 **** 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/^/ /' echo echo "Don't forget to" echo " - add \"$sourcebase/Makefile\" to AC_CONFIG_FILES in $configure_ac," --- 1453,1482 ---- echo "Finished." echo echo "You may need to add #include directives for the following .h files." ! ( ! # 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,"