Re: Rewrite stdbool_.h during build?
Paul Eggert <[email protected]>
| Newsgroups | gmane.comp.lib.gnulib.bugs,gmane.comp.version-control.cvs.bugs |
|---|---|
| Message-ID | <[email protected]> |
Bruno Haible <[email protected]> writes: > The reason is that I plan to install stdbool.h alongside with some libraries > whose declares functions have 'bool' as argument or return type. I haven't > done it so far (gettext-po.h has some functions returning 'int' where they > actually should return 'bool'), but someday I'll do it. > > Also it obviates the need for > #include "config.h" > in sources that only include standard header files: <stdio.h>, <stdbool.h>, ... Are these two separate reasons, or the same reason stated in a different way? It appears to me to be the latter (i.e., your other libraries don't want to include "config.h") but perhaps I'm not understanding the 1st point. As far as the 2nd point goes, I had thought that the general rule for gnulib was that client code was required to include "config.h" before including any .h file supplied by gnulib. Historically this was to support C89 keywords like "const" and "volatile". Now that we're assuming C89 or better, it's to support C99 keywords like "restrict". Such keywords must be defined before any header is included, for consistency, which is why "config.h" must be included first. I suppose that we could relax this general rule, by adding an exception for modules that don't use C99 features. Is that what you're thinking of doing? However, won't the relaxed rule be more complicated (as stdbool.h will be an exception to the exception created by this new rule :-)? It's not clear to me that the extra complexity is worth it -- but perhaps this is all because I'm not following your 1st point.