From 6801f8f4c6d8215f017fc12f6ce3e596755eccbe Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Sat, 31 Mar 2001 16:57:04 -0500 Subject: [svn-r3741] Purpose: Improvment Description: H5config.h and H5pubconf.h are generated by configure. It does not have the #ifndef _H5config_H ... #endif guard to prevent duplicated definitions if it is included more than once. It is messy to try make configure to put in those guards. Solution: HDF5 has set an internal rule that H5public.h includes H5pubconf.h and H5private.h includes H5config.h. Source files should NOT include H5config.h or H5pubconf.h directly but include it via H5public.h or H5private.h respectively. The #ifndef ... #endif in the H5public.h and H5private.h would prevent repeated definitions from repeated include. Adjusted H5FDstream.c and H5FDstream.h to follow this rule. Platforms tested: modi4, eirene. --- src/H5FDstream.c | 2 +- src/H5FDstream.h | 1 - src/H5private.h | 8 ++++++++ src/H5public.h | 8 ++++++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/H5FDstream.c b/src/H5FDstream.c index 79d9b5c..48a4edd 100644 --- a/src/H5FDstream.c +++ b/src/H5FDstream.c @@ -21,7 +21,7 @@ * */ -#include /* H5_HAVE_STREAM */ +#include /* H5_HAVE_STREAM */ /* Only build this driver if it was configured with --with-Stream-VFD */ #ifdef H5_HAVE_STREAM diff --git a/src/H5FDstream.h b/src/H5FDstream.h index 6ea2e7e..ec0dc17 100644 --- a/src/H5FDstream.h +++ b/src/H5FDstream.h @@ -20,7 +20,6 @@ #ifdef H5_HAVE_STREAM -#include #include /* check what sockets type we have (Unix or Windows sockets) diff --git a/src/H5private.h b/src/H5private.h index da63965..f4db86b 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -13,6 +13,14 @@ #ifndef _H5private_H #define _H5private_H #include /* Include Public Definitions */ +/* + * Since H5config.h is a generated header file, it is messy to try + * to put a #ifndef _H5config_H ... #endif guard in it. + * HDF5 has set an internal rule that it is being included here. + * Source files should NOT include H5config.h directly but include + * it via H5private.h. The #ifndef _H5private_H guard above would + * prevent repeated include. + */ #include /* Include all configuration info */ /* include the pthread library */ diff --git a/src/H5public.h b/src/H5public.h index fe2d54f..8cbb25f 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -20,6 +20,14 @@ #define _H5public_H /* Include files for public use... */ +/* + * Since H5pubconf.h is a generated header file, it is messy to try + * to put a #ifndef _H5pubconf_H ... #endif guard in it. + * HDF5 has set an internal rule that it is being included here. + * Source files should NOT include H5pubconf.h directly but include + * it via H5public.h. The #ifndef _H5public_H guard above would + * prevent repeated include. + */ #include /*from configure */ #include #ifdef H5_STDC_HEADERS -- cgit v0.12