Hi, I'm using gnulib's manywarnings module in findutils. I have an --enable-compiler-warning configure option which turns on the warnings. Since most people won't use this option, I call gl_MANYWARN_ALL_GCC unconditionally to help discover systems on which this doesn't work (none found yet!). This means that $warnings is set to the set of supported warnings, though later we remove some as shown below. However, I then use the value of $warnings inside the "enabled" arm of AC_ARG_ENABLE. So I have an implicit assumption that no other code will use the shell variable ${warnings}.
Since the variable doesn't begin ac_ I know that Autoconf won't stamp on it, and as I understand it since it doesn't begin gl_, gnulib won't stamp on it. Is doing things this way my best stylistic choice? Here is the code I'm using (the code in findutils is very similar, apart from some missing quoting that I will be fixing shortly). # Enable various GCC warnings. gl_MANYWARN_ALL_GCC([warnings]) # Set up the list of the pointless, undesired warnings. nw= nw="${nw} -Wsystem-headers" # Don't let system headers trigger warnings nw="${nw} -Wundef" # All compiler preprocessors support #if UNDEF nw="${nw} -Wtraditional" # All compilers nowadays support ANSI C nw="${nw} -Wconversion" # These warnings usually don't point to mistakes. nw="${nw} -Wsign-conversion" # Likewise. nw="${nw} -Wc++-compat" # malloc returns void* and a cast would be ugly. # Warnings we might enable in the future, but not yet (because they generate a # lot of noise). marginal="" marginal="${marginal} -Wtraditional-conversion" marginal="${marginal} -Wpadded" marginal="${marginal} -Wformat-nonliteral" marginal="${marginal} -Wunreachable-code" marginal="${marginal} -Wunused-parameter" excluded_warnings="${nw} ${marginal}" # Enable all GCC warnings not in this list. gl_MANYWARN_COMPLEMENT([warnings], [${warnings}], [${excluded_warnings}]) AC_ARG_ENABLE(compiler-warnings, AS_HELP_STRING(--enable-compiler-warnings,Enable many compiler warnings), [ for w in ${warnings} do gl_WARN_ADD([${w}]) done ] ) Thanks, James. -- This email is intended solely for the use of its addressee, sender, and any readers of a mailing list archive in which it happens to appear. If you have received this email in error, please say or type three times, "I believe in the utility of email disclaimers," and then reply to the author correcting any spellings (and, optionally, any incorrect spellings), accompanying these with humorous jests about the author's parentage. If you are not the addressee, you are nevertheless permitted to both copy and forward this email since without such permissions email systems are unable to transmit email to anybody, intended recipient or not. To those still reading by this point, the author would like to apologise for being unable to maintain a consistent level of humour throughout this disclaimer. Contents may settle during transit. Do not feed the animals.