[PATCH] Unify usage of include guards.

Eugene Syromyatnikov evgsyr at gmail.com
Sun Aug 7 03:44:19 UTC 2016


This commit is an attempt to unify usage of include guards (in top-level
headers, at least). As a side note, different files with *.h extension
have different semantics: for example, printargs.h is included multiple
times in order to generate slightly varying code depending on values of
macro definitions - maybe it's better to change extension of such files
to *.inc or *.i.

* defs.h: Add include guard.
* flock.h: Likewise.
* ipc_defs.h: Likewise.
* mpers_type.h: Likewise.
* printsiginfo.h: Likewise.
* ptrace.h: Likewise.
* regs.h: Likewise.
* seccomp_fprog.h: Likewise.

* gcc_compat.h: Include guard updated in order to have the same
                formatting as the others.
* kernel_types.h: Likewise.
* msghdr.h: Likewise.
* sigevent.h: Likewise.

* xlat.h: Add missing include guard definition.
---
 defs.h          |    5 +++++
 flock.h         |    5 +++++
 gcc_compat.h    |    6 +++---
 ipc_defs.h      |    5 +++++
 kernel_types.h  |    5 ++---
 mpers_type.h    |    5 +++++
 msghdr.h        |    6 +++---
 printsiginfo.h  |    5 +++++
 ptrace.h        |    5 +++++
 regs.h          |    5 +++++
 seccomp_fprog.h |    5 +++++
 sigevent.h      |    6 +++---
 xlat.h          |    3 ++-
 13 files changed, 53 insertions(+), 13 deletions(-)

diff --git a/defs.h b/defs.h
index bfe76e2..eabce52 100644
--- a/defs.h
+++ b/defs.h
@@ -27,6 +27,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifndef STRACE_DEFS_H
+#define STRACE_DEFS_H
+
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
@@ -901,3 +904,5 @@ extern unsigned num_quals;
 #define PRI__d64 PRI__64"d"
 #define PRI__u64 PRI__64"u"
 #define PRI__x64 PRI__64"x"
+
+#endif /* #ifndef STRACE_DEFS_H */
diff --git a/flock.h b/flock.h
index b1ab8ff..b438ea5 100644
--- a/flock.h
+++ b/flock.h
@@ -25,6 +25,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifndef STRACE_FLOCK_H
+#define STRACE_FLOCK_H
+
 #include <linux/fcntl.h>
 
 #if defined HAVE_STRUCT_FLOCK
@@ -42,3 +45,5 @@ typedef struct __kernel_flock64 struct_kernel_flock64;
 #else
 # error struct flock64 definition not found in <linux/fcntl.h>
 #endif
+
+#endif /* #ifndef STRACE_FLOCK_H */
diff --git a/gcc_compat.h b/gcc_compat.h
index c06d3c1..0f76fbb 100644
--- a/gcc_compat.h
+++ b/gcc_compat.h
@@ -25,8 +25,8 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef GCC_COMPAT_H_
-#define GCC_COMPAT_H_
+#ifndef STRACE_GCC_COMPAT_H
+#define STRACE_GCC_COMPAT_H
 
 #if defined __GNUC__ && defined __GNUC_MINOR__
 # define GNUC_PREREQ(maj, min)	\
@@ -76,4 +76,4 @@
 # define ATTRIBUTE_ALLOC_SIZE(args)	/* empty */
 #endif
 
-#endif
+#endif /* #ifndef STRACE_GCC_COMPAT_H */
diff --git a/ipc_defs.h b/ipc_defs.h
index b6c85c1..0ece103 100644
--- a/ipc_defs.h
+++ b/ipc_defs.h
@@ -25,6 +25,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifndef STRACE_IPC_DEFS_H
+#define STRACE_IPC_DEFS_H
+
 #ifdef HAVE_SYS_IPC_H
 # include <sys/ipc.h>
 #elif defined HAVE_LINUX_IPC_H
@@ -40,3 +43,5 @@
 #define PRINTCTL(flagset, arg, dflt) \
 	if ((arg) & IPC_64) tprints("IPC_64|"); \
 	printxval((flagset), (arg) &~ IPC_64, dflt)
+
+#endif /* #ifndef STRACE_IPC_DEFS_H */
diff --git a/kernel_types.h b/kernel_types.h
index 3dee761..47fbff4 100644
--- a/kernel_types.h
+++ b/kernel_types.h
@@ -26,8 +26,7 @@
  */
 
 #ifndef STRACE_KERNEL_TYPES_H
-
-# define STRACE_KERNEL_TYPES_H
+#define STRACE_KERNEL_TYPES_H
 
 # if defined HAVE___KERNEL_LONG_T && defined HAVE___KERNEL_ULONG_T
 
@@ -55,4 +54,4 @@ typedef struct {
 	char		d_name[1];
 } kernel_dirent;
 
-#endif
+#endif /* #ifndef STRACE_KERNEL_TYPES_H */
diff --git a/mpers_type.h b/mpers_type.h
index 4ce569b..f9bb2c5 100644
--- a/mpers_type.h
+++ b/mpers_type.h
@@ -26,6 +26,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifndef STRACE_MPERS_TYPE_H
+#define STRACE_MPERS_TYPE_H
+
 #ifdef IN_MPERS
 # define STRINGIFY(a) #a
 # define DEF_MPERS_TYPE(args) STRINGIFY(args.h)
@@ -45,3 +48,5 @@
 #  define MPERS_DEFS "native_defs.h"
 # endif
 #endif
+
+#endif /* #ifndef STRACE_MPERS_TYPE_H */
diff --git a/msghdr.h b/msghdr.h
index 41a07d7..b56fe61 100644
--- a/msghdr.h
+++ b/msghdr.h
@@ -1,5 +1,5 @@
-#ifndef MSGHDR_H_
-# define MSGHDR_H_
+#ifndef STRACE_MSGHDR_H
+#define STRACE_MSGHDR_H
 
 /* For definitions of struct msghdr and struct mmsghdr. */
 # include <sys/socket.h>
@@ -14,4 +14,4 @@ struct mmsghdr {
 struct tcb;
 extern void print_struct_msghdr(struct tcb *, const struct msghdr *, const int *, unsigned long);
 
-#endif /* MSGHDR_H_ */
+#endif /* #ifndef STRACE_MSGHDR_H */
diff --git a/printsiginfo.h b/printsiginfo.h
index cb2d99d..f2dd62f 100644
--- a/printsiginfo.h
+++ b/printsiginfo.h
@@ -1 +1,6 @@
+#ifndef STRACE_PRINTSIGINFO_H
+#define STRACE_PRINTSIGINFO_H
+
 extern void printsiginfo(const siginfo_t *);
+
+#endif /* #ifndef STRACE_PRINTSIGINFO_H */
diff --git a/ptrace.h b/ptrace.h
index 2e7d5e3..aba61b7 100644
--- a/ptrace.h
+++ b/ptrace.h
@@ -33,6 +33,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifndef STRACE_PTRACE_H
+#define STRACE_PTRACE_H
+
 #ifdef NEED_PTRACE_PROTOTYPE_WORKAROUND
 # define ptrace xptrace
 # include <sys/ptrace.h>
@@ -172,3 +175,5 @@ extern long ptrace(int, int, char *, long);
 #if !HAVE_DECL_PTRACE_POKEUSER
 # define PTRACE_POKEUSER PTRACE_POKEUSR
 #endif
+
+#endif /* #ifndef STRACE_PTRACE_H */
diff --git a/regs.h b/regs.h
index 9b0746c..7bf4305 100644
--- a/regs.h
+++ b/regs.h
@@ -1,3 +1,6 @@
+#ifndef STRACE_REGS_H
+#define STRACE_REGS_H
+
 #include <sys/user.h>
 
 #ifdef HAVE_SYS_REG_H
@@ -5,3 +8,5 @@
 #endif
 
 #include "arch_regs.h"
+
+#endif /* #ifndef STRACE_REGS_H */
diff --git a/seccomp_fprog.h b/seccomp_fprog.h
index 6b1f77f..f721072 100644
--- a/seccomp_fprog.h
+++ b/seccomp_fprog.h
@@ -1,4 +1,9 @@
+#ifndef STRACE_SECCOMP_FPROG_H
+#define STRACE_SECCOMP_FPROG_H
+
 struct seccomp_fprog {
 	unsigned short len;
 	unsigned long filter;
 };
+
+#endif /* #ifndef STRACE_SECCOMP_FPROG_H */
diff --git a/sigevent.h b/sigevent.h
index 6b3bacf..89b8522 100644
--- a/sigevent.h
+++ b/sigevent.h
@@ -25,8 +25,8 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef SIGEVENT_H_
-#define SIGEVENT_H_
+#ifndef STRACE_SIGEVENT_H
+#define STRACE_SIGEVENT_H
 
 typedef struct {
 	union {
@@ -44,4 +44,4 @@ typedef struct {
 	} sigev_un;
 } struct_sigevent;
 
-#endif
+#endif /* #ifndef STRACE_SIGEVENT_H */
diff --git a/xlat.h b/xlat.h
index 2f7643c..c8073b8 100644
--- a/xlat.h
+++ b/xlat.h
@@ -1,4 +1,5 @@
 #ifndef STRACE_XLAT_H
+#define STRACE_XLAT_H
 
 # include <stdint.h>
 
@@ -13,4 +14,4 @@ struct xlat {
 # define XLAT_TYPE_PAIR(type, val, str)	{     (type)(val), str  }
 # define XLAT_END			{		0, 0    }
 
-#endif
+#endif /* #ifndef STRACE_XLAT_H */
-- 
1.7.10.4





More information about the Strace-devel mailing list