# New Ticket Created by Mark Glines
# Please include the string: [perl #42903]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=42903 >
Hi,
The attached patch adds a bullet to PDD07 about headerfile guards, and
adds a test to c/codingstd/ to check for existence, uniqueness, and
lack of conflicting names. Then it fixes up all headers returned by
Parrot::Distribution->c_header_files(), to pass the tests.
(Are there any headers hiding here and there that Parrot::Distribution
doesn't know about?)
As a special case, the test ignores bison-generated headers, which do
not include guards. It might be useful to try to convince bison to emit
some, or postprocess bison's output with perl, to add a guard header and
footer.
Mark
Index: docs/pdds/pdd07_codingstd.pod
===================================================================
--- docs/pdds/pdd07_codingstd.pod (revision 18452)
+++ docs/pdds/pdd07_codingstd.pod (working copy)
@@ -254,6 +254,26 @@
Variable names must be included for all function parameters in the function
declarations.
+=item *
+
+Header files must be wrapped with guard macros, which must have a PARROT_,
+followed by some unique and descriptive text identifying the header file, and
+be followed with a _GUARD suffix. The matching #endif must have the guard
+macro name in a comment, to prevent confusion. For example, a file named
+parrot/foo.h might look like:
+
+ #ifndef PARROT_FOO_H_GUARD
+ #define PARROT_FOO_H_GUARD
+
+ #include "parrot/config.h"
+ #ifdef PARROT_HAS_FEATURE_FOO
+ typedef struct foo {
+ ...
+ } foo_t;
+ #endif /* PARROT_HAS_FEATURE_FOO */
+
+ #endif /* PARROT_FOO_H_GUARD */
+
=back
Index: t/codingstd/c_header_guards.t
===================================================================
--- t/codingstd/c_header_guards.t (revision 0)
+++ t/codingstd/c_header_guards.t (revision 0)
@@ -0,0 +1,122 @@
+#! perl
+# Copyright (C) 2006-2007, The Perl Foundation.
+# $Id$
+
+use strict;
+use warnings;
+
+use lib qw( . lib ../lib ../../lib );
+use Test::More tests => 5;
+use Parrot::Distribution;
+
+=head1 NAME
+
+t/codingstd/c_header_guards.t - checks for rules related to guards in C header files
+
+=head1 SYNOPSIS
+
+ # test all files
+ % prove t/codingstd/c_header_guards.t
+
+ # test specific files
+ % perl t/codingstd/c_header_guards.t include/parrot/bar.h
+
+=head1 DESCRIPTION
+
+Checks that all C language header files have an #ifndef PARROT_WHATEVER_H_GUARD definition,
+and an #endif /* PARROT_WHATEVER_H_GUARD */ at the end, as specified in PDD07.
+
+=head1 SEE ALSO
+
+L<docs/pdds/pdd07_codingstd.pod>
+
+=cut
+
+my $DIST = Parrot::Distribution->new();
+my @files = @ARGV ? @ARGV : map { $_->path() } $DIST->c_header_files();
+
+#foreach my $file ( @files ) {
+# print $file, "\n";
+#}
+#exit;
+
+check_header_guards(@files);
+
+exit;
+
+sub check_header_guards {
+ my (%guardnames, %redundants, %collisions,
+ %missing_guard, %missing_define, %missing_comment);
+
+F: foreach my $file (@_) {
+ open my $fh, '<', $file
+ or die "Can not open '$file' for reading!\n";
+ my @source = <$fh>;
+ close $fh;
+ chomp @source;
+
+ my ($ifndef, $define, $endif);
+L: foreach my $line (@source) {
+ $line =~ s/\s+/ /;
+ $line =~ s/^ //;
+
+ # skip Bison parser files
+ next F if $line =~ /A Bison parser/;
+
+ # skip the non-preprocessor lines
+ next L unless substr($line,0,1) eq '#';
+
+ # skip the "#", and any leading whitespace
+ $line = substr($line, 1);
+ $line =~ s/^ //;
+
+ if($line =~ m[ifndef (PARROT_.+_GUARD)$]) {
+ # check for multiple guards in the same file
+ $redundants{$file} = $1 if defined $ifndef;
+ # check for the same guard-name in multiple files
+ $collisions{$file} = $guardnames{$1}
+ if exists $guardnames{1};
+
+ $ifndef = $1;
+ $guardnames{$1} = $file;
+ }
+
+ if($line =~ m[define (PARROT_.+_GUARD)$]) {
+ $define = $1
+ if(defined($ifndef) && $ifndef eq $1);
+ }
+
+ if($line =~ m[endif /\* (PARROT_.+_GUARD) \*/$]) {
+ $endif = $1
+ if(defined($ifndef) && $ifndef eq $1);
+ }
+ }
+
+ $missing_guard{$file} = 1 unless defined $ifndef;
+ $missing_define{$file} = 1 unless defined $define;
+ $missing_comment{$file} = 1 unless defined $endif;
+ }
+ ok(!(scalar %collisions), "identical PARROT_*_GUARD macro names used in headers");
+ diag("collisions: " . join(", ", %collisions))
+ if scalar keys %collisions;
+ ok(!(scalar %redundants), "multiple PARROT_*_GUARD macros found in headers");
+ diag("redundants: " . join(", ", keys %redundants))
+ if scalar keys %redundants;
+ ok(!(scalar %missing_guard), "missing or misspelled PARROT_*_GUARD ifndef in headers");
+ diag("missing guard: " . join(", ", sort keys %missing_guard))
+ if scalar keys %missing_guard;
+ ok(!(scalar %missing_define), "missing or misspelled PARROT_*_GUARD define in headers");
+ diag("missing define: " . join(", ", sort keys %missing_define))
+ if scalar keys %missing_define;
+ ok(!(scalar %missing_comment), "missing or misspelled PARROT_*_GUARD comment after the #endif in headers");
+ diag("missing endif comment: " . join(", ", sort keys %missing_comment))
+ if scalar keys %missing_comment;
+}
+return 0;
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
Index: compilers/bcg/src/bcg_utils.h
===================================================================
--- compilers/bcg/src/bcg_utils.h (revision 18452)
+++ compilers/bcg/src/bcg_utils.h (working copy)
@@ -1,5 +1,5 @@
-#ifndef PARROT_BCG_UTILS_H
-# define PARROT_BCG_UTILS_H
+#ifndef PARROT_BCG_UTILS_H_GUARD
+#define PARROT_BCG_UTILS_H_GUARD
# include "bcg.h"
@@ -12,7 +12,7 @@
void *value);
void *bcg_hash_get(BCG_info * bcg_info, bcg_hash * hash, char *key);
-#endif /* PARROT_BCG_UTILS_H */
+#endif /* PARROT_BCG_UTILS_H_GUARD */
/*
* Local variables:
Index: compilers/pirc/src/jsonout.h
===================================================================
--- compilers/pirc/src/jsonout.h (revision 18452)
+++ compilers/pirc/src/jsonout.h (working copy)
@@ -1,5 +1,5 @@
#ifndef PARROT_PIRC_JSONOUT_H_GUARD
-# define PARROT_PIRC_JSONOUT_H_GUARD
+#define PARROT_PIRC_JSONOUT_H_GUARD
/* predeclare */
struct pirvtable;
Index: compilers/pirc/src/pastout.h
===================================================================
--- compilers/pirc/src/pastout.h (revision 18452)
+++ compilers/pirc/src/pastout.h (working copy)
@@ -1,5 +1,5 @@
#ifndef PARROT_PIRC_PASTOUT_H_GUARD
-# define PARROT_PIRC_PASTOUT_H_GUARD
+#define PARROT_PIRC_PASTOUT_H_GUARD
/* predeclare */
struct pirvtable;
Index: compilers/pirc/src/pbcout.h
===================================================================
--- compilers/pirc/src/pbcout.h (revision 18452)
+++ compilers/pirc/src/pbcout.h (working copy)
@@ -1,5 +1,5 @@
#ifndef PARROT_PIRC_PBCOUT_H_GUARD
-# define PARROT_PIRC_PBCOUT_H_GUARD
+#define PARROT_PIRC_PBCOUT_H_GUARD
extern struct pirvtable *init_pbc_vtable(char *outputfile);
Index: compilers/pirc/src/pirlexer.h
===================================================================
--- compilers/pirc/src/pirlexer.h (revision 18452)
+++ compilers/pirc/src/pirlexer.h (working copy)
@@ -1,5 +1,5 @@
#ifndef PARROT_PIRC_PIRLEXER_H_GUARD
-# define PARROT_PIRC_PIRLEXER_H_GUARD
+#define PARROT_PIRC_PIRLEXER_H_GUARD
typedef enum tokens {
T_GLOBAL, /* "global" */
Index: compilers/pirc/src/pirout.h
===================================================================
--- compilers/pirc/src/pirout.h (revision 18452)
+++ compilers/pirc/src/pirout.h (working copy)
@@ -1,5 +1,5 @@
#ifndef PARROT_PIRC_PIROUT_H_GUARD
-# define PARROT_PIRC_PIROUT_H_GUARD
+#define PARROT_PIRC_PIROUT_H_GUARD
/* predeclare */
struct pirvtable;
Index: compilers/pirc/src/pirparser.h
===================================================================
--- compilers/pirc/src/pirparser.h (revision 18452)
+++ compilers/pirc/src/pirparser.h (working copy)
@@ -1,5 +1,5 @@
#ifndef PARROT_PIRC_PIRPARSER_H_GUARD
-# define PARROT_PIRC_PIRPARSER_H_GUARD
+#define PARROT_PIRC_PIRPARSER_H_GUARD
# include "pirlexer.h"
# include "pirvtable.h"
Index: compilers/pirc/src/pirutil.h
===================================================================
--- compilers/pirc/src/pirutil.h (revision 18452)
+++ compilers/pirc/src/pirutil.h (working copy)
@@ -1,5 +1,5 @@
#ifndef PARROT_PIRC_PIRUTIL_H_GUARD
-# define PARROT_PIRC_PIRUTIL_H_GUARD
+#define PARROT_PIRC_PIRUTIL_H_GUARD
# include <stdio.h>
Index: compilers/pirc/src/pirvtable.h
===================================================================
--- compilers/pirc/src/pirvtable.h (revision 18452)
+++ compilers/pirc/src/pirvtable.h (working copy)
@@ -1,5 +1,5 @@
#ifndef PARROT_PIRC_PIRVTABLE_H_GUARD
-# define PARROT_PIRC_PIRVTABLE_H_GUARD
+#define PARROT_PIRC_PIRVTABLE_H_GUARD
/* predeclaration; the actual definition is left to the back-end(s) */
struct emit_data;
Index: config/gen/platform/ansi/io.h
===================================================================
--- config/gen/platform/ansi/io.h (revision 18452)
+++ config/gen/platform/ansi/io.h (working copy)
@@ -2,11 +2,16 @@
** I/O:
*/
+#ifndef PARROT_PLATFORM_ANSI_IO_H_GUARD
+#define PARROT_PLATFORM_ANSI_IO_H_GUARD
+
#define DEFAULT_OPEN_MODE 0
#ifndef S_ISREG
# define S_ISREG(m) 1
#endif
+#endif /* PARROT_PLATFORM_ANSI_IO_H_GUARD */
+
/*
* Local variables:
* c-file-style: "parrot"
Index: config/gen/platform/generic/dl.h
===================================================================
--- config/gen/platform/generic/dl.h (revision 18452)
+++ config/gen/platform/generic/dl.h (working copy)
@@ -1,3 +1,5 @@
+#ifndef PARROT_PLATFORM_GENERIC_DL_H_GUARD
+#define PARROT_PLATFORM_GENERIC_DL_H_GUARD
/*
* Dynamic loading stuff:
*/
@@ -4,6 +6,8 @@
#define PARROT_DLOPEN_FLAGS RTLD_LAZY
+#endif /* PARROT_PLATFORM_GENERIC_DL_H_GUARD */
+
/*
* Local variables:
* c-file-style: "parrot"
Index: config/gen/platform/generic/io.h
===================================================================
--- config/gen/platform/generic/io.h (revision 18452)
+++ config/gen/platform/generic/io.h (working copy)
@@ -1,3 +1,5 @@
+#ifndef PARROT_PLATFORM_GENERIC_IO_H_GUARD
+#define PARROT_PLATFORM_GENERIC_IO_H_GUARD
/*
* I/O:
*/
@@ -7,6 +9,8 @@
# define S_ISREG(m) ((m & S_IFMT) == S_IFREG)
#endif
+#endif /* PARROT_PLATFORM_GENERIC_IO_H_GUARD */
+
/*
* Local variables:
* c-file-style: "parrot"
Index: config/gen/platform/generic/math.h
===================================================================
--- config/gen/platform/generic/math.h (revision 18452)
+++ config/gen/platform/generic/math.h (working copy)
@@ -1,3 +1,5 @@
+#ifndef PARROT_PLATFORM_GENERIC_MATH_H_GUARD
+#define PARROT_PLATFORM_GENERIC_MATH_H_GUARD
/*
* math related stuff
*/
@@ -20,6 +22,8 @@
#define Parrot_is_nzero(x) ((x) == 0.0 && signbit(x))
+#endif /* PARROT_PLATFORM_GENERIC_MATH_H_GUARD */
+
/*
* Local variables:
* c-file-style: "parrot"
Index: config/gen/platform/generic/signal.h
===================================================================
--- config/gen/platform/generic/signal.h (revision 18452)
+++ config/gen/platform/generic/signal.h (working copy)
@@ -1,3 +1,5 @@
+#ifndef PARROT_PLATFORM_GENERIC_SIGNAL_H_GUARD
+#define PARROT_PLATFORM_GENERIC_SIGNAL_H_GUARD
/*
* Signal handling stuff
*/
@@ -19,6 +21,8 @@
Parrot_sighandler_t Parrot_set_sighandler(int s, Parrot_sighandler_t f);
#endif
+#endif /* PARROT_PLATFORM_GENERIC_SIGNAL_H_GUARD */
+
/*
* Local variables:
* c-file-style: "parrot"
Index: config/gen/platform/generic/stat.h
===================================================================
--- config/gen/platform/generic/stat.h (revision 18452)
+++ config/gen/platform/generic/stat.h (working copy)
@@ -1,3 +1,5 @@
+#ifndef PARROT_PLATFORM_GENERIC_STAT_H_GUARD
+#define PARROT_PLATFORM_GENERIC_STAT_H_GUARD
/*
* File stat stuff
*/
@@ -6,6 +8,8 @@
# include <sys/stat.h>
#endif
+#endif /* PARROT_PLATFORM_GENERIC_STAT_H_GUARD */
+
/*
* Local variables:
* c-file-style: "parrot"
Index: config/gen/platform/generic/threads.h
===================================================================
--- config/gen/platform/generic/threads.h (revision 18452)
+++ config/gen/platform/generic/threads.h (working copy)
@@ -1,3 +1,5 @@
+#ifndef PARROT_PLATFORM_GENERIC_THREADS_H_GUARD
+#define PARROT_PLATFORM_GENERIC_THREADS_H_GUARD
/*
* POSIX threading stuff
*/
@@ -13,6 +15,8 @@
# endif
#endif
+#endif /* PARROT_PLATFORM_GENERIC_THREADS_H_GUARD */
+
/*
* Local variables:
* c-file-style: "parrot"
Index: config/gen/platform/openbsd/misc.h
===================================================================
--- config/gen/platform/openbsd/misc.h (revision 18452)
+++ config/gen/platform/openbsd/misc.h (working copy)
@@ -1,3 +1,5 @@
+#ifndef PARROT_PLATFORM_OPENBSD_MISC_H_GUARD
+#define PARROT_PLATFORM_OPENBSD_MISC_H_GUARD
/*
** Miscellaneous:
*/
@@ -8,6 +10,8 @@
# define PARROT_OPENBSD_ELF
#endif
+#endif /* PARROT_PLATFORM_OPENBSD_MISC_H_GUARD */
+
/*
* Local variables:
* c-file-style: "parrot"
Index: config/gen/platform/platform_interface.h
===================================================================
--- config/gen/platform/platform_interface.h (revision 18452)
+++ config/gen/platform/platform_interface.h (working copy)
@@ -1,5 +1,5 @@
-#ifndef PLATFORM_INTERFACE_H_GUARD
-#define PLATFORM_INTERFACE_H_GUARD
+#ifndef PARROT_PLATFORM_INTERFACE_H_GUARD
+#define PARROT_PLATFORM_INTERFACE_H_GUARD
/*
** platform_interface.h
*/
@@ -126,7 +126,7 @@
INTVAL Parrot_Run_OS_Command_Argv(Interp*, struct PMC *);
void Parrot_Exec_OS_Command_Argv(Interp*, struct PMC *);
-#endif /* PLATFORM_INTERFACE_H_GUARD */
+#endif /* PARROT_PLATFORM_INTERFACE_H_GUARD */
/*
* Local variables:
Index: config/gen/platform/win32/io.h
===================================================================
--- config/gen/platform/win32/io.h (revision 18452)
+++ config/gen/platform/win32/io.h (working copy)
@@ -1,3 +1,6 @@
+#ifndef PARROT_PLATFORM_WIN32_IO_H_GUARD
+#define PARROT_PLATFORM_WIN32_IO_H_GUARD
+
#define DEFAULT_OPEN_MODE 0
typedef void* Parrot_WIN32_HANDLE;
@@ -7,6 +10,8 @@
# define S_ISREG(m) ((m & S_IFMT) == S_IFREG)
#endif
+#endif /* PARROT_PLATFORM_WIN32_IO_H_GUARD */
+
/*
* Local variables:
* c-file-style: "parrot"
Index: config/gen/platform/win32/misc.h
===================================================================
--- config/gen/platform/win32/misc.h (revision 18452)
+++ config/gen/platform/win32/misc.h (working copy)
@@ -1,3 +1,6 @@
+#ifndef PARROT_PLATFORM_WIN32_MISC_H_GUARD
+#define PARROT_PLATFORM_WIN32_MISC_H_GUARD
+
#define PARROT_HAS_PLATFORM_INIT_CODE
void Parrot_platform_init_code(void);
@@ -13,6 +16,8 @@
* been removed' warnings in header files */
#endif /* defined(_MSC_VER) */
+#endif /* PARROT_PLATFORM_WIN32_MISC_H_GUARD */
+
/*
* Local variables:
* c-file-style: "parrot"
Index: config/gen/platform/win32/signal.h
===================================================================
--- config/gen/platform/win32/signal.h (revision 18452)
+++ config/gen/platform/win32/signal.h (working copy)
@@ -1,3 +1,6 @@
+#ifndef PARROT_PLATFORM_WIN32_SIGNAL_H_GUARD
+#define PARROT_PLATFORM_WIN32_SIGNAL_H_GUARD
+
/*
* empty to prevent inclusion of generic/signal.h
*/
@@ -2,2 +5,4 @@
+#endif /* PARROT_PLATFORM_WIN32_SIGNAL_H_GUARD */
+
/*
Index: config/gen/platform/win32/stat.h
===================================================================
--- config/gen/platform/win32/stat.h (revision 18452)
+++ config/gen/platform/win32/stat.h (working copy)
@@ -1,3 +1,6 @@
+#ifndef PARROT_PLATFORM_WIN32_STAT_H_GUARD
+#define PARROT_PLATFORM_WIN32_STAT_H_GUARD
+
#ifndef S_IFMT
# ifdef _S_IFMT
# define S_IFMT _S_IFMT
@@ -22,6 +25,8 @@
# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
#endif
+#endif /* PARROT_PLATFORM_WIN32_STAT_H_GUARD */
+
/*
* Local variables:
* c-file-style: "parrot"
Index: config/gen/platform/win32/threads.h
===================================================================
--- config/gen/platform/win32/threads.h (revision 18452)
+++ config/gen/platform/win32/threads.h (working copy)
@@ -1,6 +1,9 @@
+#ifndef PARROT_PLATFORM_WIN32_THREADS_H_GUARD
+#define PARROT_PLATFORM_WIN32_THREADS_H_GUARD
#include "parrot/thr_windows.h"
+#endif /* PARROT_PLATFORM_WIN32_THREADS_H_GUARD */
/*
* Local variables:
Index: include/parrot/atomic/fallback.h
===================================================================
--- include/parrot/atomic/fallback.h (revision 18452)
+++ include/parrot/atomic/fallback.h (working copy)
@@ -12,7 +12,7 @@
*/
#ifndef PARROT_ATOMIC_FALLBACK_H_GUARD
-# define PARROT_ATOMIC_FALLBACK_H_GUARD
+#define PARROT_ATOMIC_FALLBACK_H_GUARD
typedef struct Parrot_atomic_pointer {
void *val;
Index: include/parrot/atomic/gcc_pcc.h
===================================================================
--- include/parrot/atomic/gcc_pcc.h (revision 18452)
+++ include/parrot/atomic/gcc_pcc.h (working copy)
@@ -12,8 +12,8 @@
* References:
*/
-#ifndef ATOMIC_GCC_PCC_H_GUARD
-# define ATOMIC_GCC_PCC_H_GUARD
+#ifndef PARROT_ATOMIC_GCC_PCC_H_GUARD
+#define PARROT_ATOMIC_GCC_PCC_H_GUARD
typedef struct Parrot_atomic_pointer {
void * volatile val;
@@ -115,7 +115,7 @@
result = parrot_ppc_add(&(a).val, -1); \
} while (0)
-#endif /* ATOMIC_GCC_PCC_H_GUARD */
+#endif /* PARROT_ATOMIC_GCC_PCC_H_GUARD */
/*
* Local variables:
Index: include/parrot/atomic.h
===================================================================
--- include/parrot/atomic.h (revision 18452)
+++ include/parrot/atomic.h (working copy)
@@ -12,7 +12,7 @@
#ifndef PARROT_ATOMIC_H_GUARD
-# define PARROT_ATOMIC_H_GUARD
+#define PARROT_ATOMIC_H_GUARD
# include "parrot/has_header.h"
# include "parrot/thread.h"
Index: include/parrot/atomic/sparc.h
===================================================================
--- include/parrot/atomic/sparc.h (revision 18452)
+++ include/parrot/atomic/sparc.h (working copy)
@@ -12,8 +12,8 @@
* References:
*/
-#ifndef ATOMIC_SPARC_H_GUARD
-#define ATOMIC_SPARC_H_GUARD
+#ifndef PARROT_ATOMIC_SPARC_H_GUARD
+#define PARROT_ATOMIC_SPARC_H_GUARD
extern int parrot_sparc_cas32(Parrot_UInt4 *value, Parrot_UInt4 old, Parrot_UInt4 new);
/* NB cas64 _will_ be broken when PTR_SIZE == 4 */
@@ -83,7 +83,7 @@
#define PARROT_ATOMIC_INT_DEC(result, a) parrot_sparc_atomic_int_add(result, a, -1)
#define PARROT_ATOMIC_INT_INC(result, a) parrot_sparc_atomic_int_add(result, a, 1)
-#endif /* ATOMIC_SPARC_H_GUARD */
+#endif /* PARROT_ATOMIC_SPARC_H_GUARD */
/*
* Local variables:
Index: include/parrot/exec.h
===================================================================
--- include/parrot/exec.h (revision 18452)
+++ include/parrot/exec.h (working copy)
@@ -11,9 +11,10 @@
* References:
*/
+#ifndef PARROT_EXEC_H_GUARD
+#define PARROT_EXEC_H_GUARD
+
#if EXEC_CAPABLE
-# if !defined(PARROT_EXEC_H_GUARD)
-# define PARROT_EXEC_H_GUARD
# if PARROT_EXEC_OS_OPENBSD
# ifdef PARROT_OPENBSD_ELF
@@ -113,9 +114,10 @@
void Parrot_exec_emit_mov_rm_n(Interp *interp, int reg, char *mem);
/* HEADERIZER END: src/exec.c */
-#endif /* PARROT_EXEC_H_GUARD */
#endif /* EXEC_CAPABLE */
+#endif /* PARROT_EXEC_H_GUARD */
+
/*
* Local variables:
* c-file-style: "parrot"
Index: include/parrot/smallobject.h
===================================================================
--- include/parrot/smallobject.h (revision 18452)
+++ include/parrot/smallobject.h (working copy)
@@ -1,5 +1,5 @@
#ifndef PARROT_SMALLOBJECT_H_GUARD
-# define PARROT_SMALLOBJECT_H_GUARD
+#define PARROT_SMALLOBJECT_H_GUARD
# include "parrot/parrot.h"
Index: include/parrot/stat.h
===================================================================
--- include/parrot/stat.h (revision 18452)
+++ include/parrot/stat.h (working copy)
@@ -45,7 +45,7 @@
PARROT_API INTVAL Parrot_fstat_info_intval(Parrot_Interp, INTVAL, INTVAL);
PARROT_API FLOATVAL Parrot_stat_info_floatval(Parrot_Interp, STRING *, INTVAL);
-#endif /* PARROT_STRING_H_GUARD */
+#endif /* PARROT_STAT_H_GUARD */
/*
* Local variables:
Index: include/parrot/stm/backend.h
===================================================================
--- include/parrot/stm/backend.h (revision 18452)
+++ include/parrot/stm/backend.h (working copy)
@@ -1,5 +1,5 @@
#ifndef PARROT_STM_BACKEND_H_GUARD
-# define PARROT_STM_BACKEND_H_GUARD
+#define PARROT_STM_BACKEND_H_GUARD
# include <parrot/parrot.h>
Index: include/parrot/thread.h
===================================================================
--- include/parrot/thread.h (revision 18452)
+++ include/parrot/thread.h (working copy)
@@ -11,7 +11,7 @@
*/
#ifndef PARROT_THREAD_H_GUARD
-# define PARROT_THREAD_H_GUARD
+#define PARROT_THREAD_H_GUARD
# include "parrot/parrot.h"
Index: include/parrot/thr_windows.h
===================================================================
--- include/parrot/thr_windows.h (revision 18452)
+++ include/parrot/thr_windows.h (working copy)
@@ -11,7 +11,7 @@
*/
#ifndef PARROT_THR_WINDOWS_H_GUARD
-# define PARROT_THR_WINDOWS_H_GUARD
+#define PARROT_THR_WINDOWS_H_GUARD
# undef CONST
# include <windows.h>
Index: languages/cola/cola.h
===================================================================
--- languages/cola/cola.h (revision 18452)
+++ languages/cola/cola.h (working copy)
@@ -9,7 +9,7 @@
*/
#ifndef PARROT_LANGUAGES_COLA_H_GUARD
-# define PARROT_LANGUAGES_COLA_H_GUARD
+#define PARROT_LANGUAGES_COLA_H_GUARD
# define COLA_VERSION "0.0.11.1"
Index: languages/dotnet/pmc/structures.h
===================================================================
--- languages/dotnet/pmc/structures.h (revision 18452)
+++ languages/dotnet/pmc/structures.h (working copy)
@@ -1,3 +1,6 @@
+#ifndef PARROT_DOTNET_PMC_STRUCTURES_H_GUARD
+#define PARROT_DOTNET_PMC_STRUCTURES_H_GUARD
+
/* Some structures relating to the .NET CLI files and metadata PMCs. */
/* This structure describes a loaded .NET assembly. */
@@ -268,6 +271,8 @@
UHUGEINTVAL x;
};
+#endif /* PARROT_DOTNET_PMC_STRUCTURES_H_GUARD */
+
/*
* Local variables:
* c-file-style: "parrot"
Index: languages/dotnet/pmc/tableinfo.h
===================================================================
--- languages/dotnet/pmc/tableinfo.h (revision 18452)
+++ languages/dotnet/pmc/tableinfo.h (working copy)
@@ -1,3 +1,6 @@
+#ifndef PARROT_DOTNET_PMC_TABLEINFO_H_GUARD
+#define PARROT_DOTNET_PMC_TABLEINFO_H_GUARD
+
/* Metadata table information. */
/* Table name => number mappings */
@@ -200,6 +203,7 @@
#define Table_TypeSpec_RL(ass) (ass->blobs_ptr_size)
+#endif /* PARROT_DOTNET_PMC_TABLEINFO_H_GUARD */
/*
* Local variables:
Index: languages/tcl/src/binary.h
===================================================================
--- languages/tcl/src/binary.h (revision 18452)
+++ languages/tcl/src/binary.h (working copy)
@@ -1,3 +1,5 @@
+#ifndef PARROT_TCL_BINARY_H_GUARD
+#define PARROT_TCL_BINARY_H_GUARD
PMC *ParTcl_binary_scan(Interp *interp, STRING *BINSTR, STRING *FORMAT);
STRING *ParTcl_binary_format(Interp *interp, STRING *FORMAT, PMC *values);
@@ -2,2 +4,4 @@
+#endif /* PARROT_TCL_BINARY_H_GUARD */
+
/*
Index: src/exec_save.h
===================================================================
--- src/exec_save.h (revision 18452)
+++ src/exec_save.h (working copy)
@@ -12,7 +12,7 @@
*/
#ifndef PARROT_EXEC_SAVE_H_GUARD
-# define PARROT_EXEC_SAVE_H_GUARD
+#define PARROT_EXEC_SAVE_H_GUARD
void Parrot_exec_save(Parrot_exec_objfile_t *obj, const char *file);
Index: src/interp_guts.h
===================================================================
--- src/interp_guts.h (revision 18452)
+++ src/interp_guts.h (working copy)
@@ -3,7 +3,7 @@
*/
#ifndef PARROT_INTERP_GUTS_H_GUARD
-# define PARROT_INTERP_GUTS_H_GUARD
+#define PARROT_INTERP_GUTS_H_GUARD
# define DO_OP(PC,INTERP) (PC = ((INTERP->op_func_table)[*PC])(PC,INTERP))
Index: src/jit/alpha/jit_emit.h
===================================================================
--- src/jit/alpha/jit_emit.h (revision 18452)
+++ src/jit/alpha/jit_emit.h (working copy)
@@ -34,7 +34,7 @@
*/
#ifndef PARROT_ALPHA_JIT_EMIT_H_GUARD
-# define PARROT_ALPHA_JIT_EMIT_H_GUARD
+#define PARROT_ALPHA_JIT_EMIT_H_GUARD
typedef enum {
REG0_v0,
Index: src/jit/arm/exec_dep.h
===================================================================
--- src/jit/arm/exec_dep.h (revision 18452)
+++ src/jit/arm/exec_dep.h (working copy)
@@ -12,7 +12,7 @@
*/
#ifndef PARROT_ARM_EXEC_DEP_H_GUARD
-# define PARROT_ARM_EXEC_DEP_H_GUARD
+#define PARROT_ARM_EXEC_DEP_H_GUARD
#ifdef JIT_CGP
Index: src/jit/arm/jit_emit.h
===================================================================
--- src/jit/arm/jit_emit.h (revision 18452)
+++ src/jit/arm/jit_emit.h (working copy)
@@ -6,8 +6,8 @@
* $Id$
*/
-#if !defined(PARROT_ARM_JIT_EMIT_H_GUARD)
-# define PARROT_ARM_JIT_EMIT_H_GUARD
+#ifndef PARROT_ARM_JIT_EMIT_H_GUARD
+#define PARROT_ARM_JIT_EMIT_H_GUARD
#ifdef ARM
# ifdef __linux
Index: src/jit/i386/exec_dep.h
===================================================================
--- src/jit/i386/exec_dep.h (revision 18452)
+++ src/jit/i386/exec_dep.h (working copy)
@@ -12,7 +12,7 @@
*/
#ifndef PARROT_I386_EXEC_DEP_H_GUARD
-# define PARROT_I386_EXEC_DEP_H_GUARD
+#define PARROT_I386_EXEC_DEP_H_GUARD
#ifdef JIT_CGP
Index: src/jit/i386/jit_emit.h
===================================================================
--- src/jit/i386/jit_emit.h (revision 18452)
+++ src/jit/i386/jit_emit.h (working copy)
@@ -7,7 +7,7 @@
*/
#ifndef PARROT_I386_JIT_EMIT_H_GUARD
-# define PARROT_I386_JIT_EMIT_H_GUARD
+#define PARROT_I386_JIT_EMIT_H_GUARD
# include <assert.h>
Index: src/jit/ia64/jit_emit.h
===================================================================
--- src/jit/ia64/jit_emit.h (revision 18452)
+++ src/jit/ia64/jit_emit.h (working copy)
@@ -1,3 +1,6 @@
+#ifndef PARROT_JIT_IA64_JIT_EMIT_H_GUARD
+#define PARROT_JIT_IA64_JIT_EMIT_H_GUARD
+
/*
* jit_emit.h
*
@@ -768,6 +771,8 @@
#endif /* !JIT_EMIT */
+#endif /* PARROT_JIT_IA64_JIT_EMIT_H_GUARD */
+
/*
* Local variables:
* c-file-style: "parrot"
Index: src/jit/mips/jit_emit.h
===================================================================
--- src/jit/mips/jit_emit.h (revision 18452)
+++ src/jit/mips/jit_emit.h (working copy)
@@ -12,7 +12,7 @@
*/
#ifndef PARROT_MIPS_JIT_EMIT_H_GUARD
-# define PARROT_MIPS_JIT_EMIT_H_GUARD
+#define PARROT_MIPS_JIT_EMIT_H_GUARD
# define BASE_REG s0
# define Parrot_jit_emit_get_base_reg_no(pc) BASE_REG
Index: src/jit/ppc/exec_dep.h
===================================================================
--- src/jit/ppc/exec_dep.h (revision 18452)
+++ src/jit/ppc/exec_dep.h (working copy)
@@ -12,7 +12,7 @@
*/
#ifndef PARROT_PPC_EXEC_DEP_H_GUARD
-# define PARROT_PPC_EXEC_DEP_H_GUARD
+#define PARROT_PPC_EXEC_DEP_H_GUARD
#ifdef JIT_CGP
Index: src/jit/ppc/jit_emit.h
===================================================================
--- src/jit/ppc/jit_emit.h (revision 18452)
+++ src/jit/ppc/jit_emit.h (working copy)
@@ -7,7 +7,7 @@
*/
#ifndef PARROT_PPC_JIT_EMIT_H_GUARD
-# define PARROT_PPC_JIT_EMIT_H_GUARD
+#define PARROT_PPC_JIT_EMIT_H_GUARD
# include <unistd.h>
# include <sys/mman.h>
Index: src/jit/skeleton/jit_emit.h
===================================================================
--- src/jit/skeleton/jit_emit.h (revision 18452)
+++ src/jit/skeleton/jit_emit.h (working copy)
@@ -7,7 +7,7 @@
*/
#ifndef PARROT_PPC_JIT_EMIT_H_GUARD
-# define PARROT_PPC_JIT_EMIT_H_GUARD
+#define PARROT_PPC_JIT_EMIT_H_GUARD
# include <unistd.h>
# include <limits.h>
Index: src/jit/sun4/jit_emit.h
===================================================================
--- src/jit/sun4/jit_emit.h (revision 18452)
+++ src/jit/sun4/jit_emit.h (working copy)
@@ -7,7 +7,7 @@
**/
#ifndef PARROT_SUN4_JIT_EMIT_H_GUARD
-# define PARROT_SUN4_JIT_EMIT_H_GUARD
+#define PARROT_SUN4_JIT_EMIT_H_GUARD
/*
* SPARC JIT overview:
Index: src/pmc/classobject.h
===================================================================
--- src/pmc/classobject.h (revision 18452)
+++ src/pmc/classobject.h (working copy)
@@ -8,7 +8,7 @@
*/
#ifndef PARROT_CLASSOBJECT_H_GUARD
-# define PARROT_CLASSOBJECT_GUARD
+#define PARROT_CLASSOBJECT_H_GUARD
/* Class PMC's underlying struct. */
typedef struct Parrot_Class {
@@ -42,7 +42,7 @@
/* Fully qualified class name generation; defined in Class, used by Object. */
STRING* Parrot_Class_get_fq_classname(Parrot_Interp interp, Parrot_Class *class_info);
-#endif /* PARROT_CLASSOBJECT_GUARD */
+#endif /* PARROT_CLASSOBJECT_H_GUARD */
/*
Index: src/trace.h
===================================================================
--- src/trace.h (revision 18452)
+++ src/trace.h (working copy)
@@ -11,7 +11,7 @@
*/
#ifndef PARROT_TRACE_H_GUARD
-# define PARROT_TRACE_H_GUARD
+#define PARROT_TRACE_H_GUARD
#include "parrot/parrot.h"