Unify usage of #include guards

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 something like *.inc.

* 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: Rename the macro used for #include guard.
* msghdr.h: Likewise.
* sigevent.h: Likewise.
* kernel_types.h: Comment the trailing part of #include guard.
* xlat.h: Add missing macro definition for #include guard.
This commit is contained in:
Eugene Syromyatnikov 2016-08-07 06:44:19 +03:00 committed by Dmitry V. Levin
parent 7b1401e965
commit 18907920bb
13 changed files with 53 additions and 13 deletions

5
defs.h
View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -1 +1,6 @@
#ifndef STRACE_PRINTSIGINFO_H
#define STRACE_PRINTSIGINFO_H
extern void printsiginfo(const siginfo_t *);
#endif /* #ifndef STRACE_PRINTSIGINFO_H */

View File

@ -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 */

5
regs.h
View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

3
xlat.h
View File

@ -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 */