diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2017-04-03 14:53:37 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2017-04-26 10:01:29 +0000 |
commit | e80dfcbcc3807ba22109d40bc297c5c64c9cc266 (patch) | |
tree | e33d23a284b5b283c8d60321d89457be8ece2de4 /lib | |
parent | fc9596af615b96d73e15b26dc83da14e7bde73c5 (diff) |
Avoid double-including config.h
config.h doesn't have include guards, so including it twice is bad. We
deal with this by checking for PACKAGE_NAME, but only in some places.
Once we start using gnulib, we will need to include config.h before any
gnulib-generated headers. This is problematic if we include it
transitively through our own private headers.
In order to set a clear rule about inclusion of config.h, it is now
included in every .c file as first header, but not in any header. This
will definitely avoid double-inclusion and satisfy the condition that it
has to be included before gnulib headers. It comes at the price of
adding some redundancy, but there is no clean way to avoid this.
Change-Id: Ib78dd7e058ef8ac93cd379dcd14a2ffbc86c1988
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ChangeLog | 5 | ||||
-rw-r--r-- | lib/crc32.c | 4 | ||||
-rw-r--r-- | lib/system.h | 4 |
3 files changed, 9 insertions, 4 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog index 84290f79..8cac7afb 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2017-04-20 Ulf Hermann <ulf.hermann@qt.io> + + * crc32.c: include config.h. + * system.h: Don't include config.h. + 2017-02-16 Ulf Hermann <ulf.hermann@qt.io> * Makefile.am (libeu_a_SOURCES): Remove version.c, add printversion.c diff --git a/lib/crc32.c b/lib/crc32.c index 1a76b1b3..758602ea 100644 --- a/lib/crc32.c +++ b/lib/crc32.c @@ -25,6 +25,10 @@ the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#if HAVE_CONFIG_H +#include <config.h> +#endif + #include <stdint.h> #include "system.h" diff --git a/lib/system.h b/lib/system.h index 2d057025..92033355 100644 --- a/lib/system.h +++ b/lib/system.h @@ -29,10 +29,6 @@ #ifndef LIB_SYSTEM_H #define LIB_SYSTEM_H 1 -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - #include <errno.h> #include <stddef.h> #include <stdint.h> |