This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
A sprinkling of 'static's and multiple-include guards
- From: "Zack Weinberg" <zack at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 07 Jan 2004 23:50:07 -0800
- Subject: A sprinkling of 'static's and multiple-include guards
These came up as I was testing a patch that makes duplicate_decls
somewhat pickier - too picky, in fact - about redeclarations of
things. None of them are strictly necessary, but they are in the
preferred style.
unwind.h gets an implementation-namespace MI guard because it appears
to be intended to be usable outside GCC.
Bootstrapped i686-linux.
zw
* dwarf2.h, unwind-dw2-fde.h, unwind-pe.h, unwind.h:
Add multiple-include guard.
cp:
* parser.c (cp_parser_save_member_function_body): Mark the
definition static.
treelang:
* parse.y (yyerror): Mark the definition static.
===================================================================
Index: dwarf2.h
--- dwarf2.h 18 Jan 2003 02:26:43 -0000 1.25
+++ dwarf2.h 8 Jan 2004 07:47:10 -0000
@@ -38,6 +38,9 @@ Software Foundation, 59 Temple Place - S
/* This file is shared between GCC and GDB, and should not contain
prototypes. */
+#ifndef GCC_DWARF2_H
+#define GCC_DWARF2_H
+
/* Tag names and codes. */
enum dwarf_tag
{
@@ -628,3 +631,5 @@ enum dwarf_macinfo_record_type
#define DW_EH_PE_aligned 0x50
#define DW_EH_PE_indirect 0x80
+
+#endif /* dwarf2.h */
===================================================================
Index: unwind-dw2-fde.h
--- unwind-dw2-fde.h 31 Oct 2003 20:46:26 -0000 1.12
+++ unwind-dw2-fde.h 8 Jan 2004 07:47:10 -0000
@@ -29,6 +29,8 @@ along with GCC; see the file COPYING. I
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
+#ifndef GCC_UNWIND_DW2_FDE_H
+#define GCC_UNWIND_DW2_FDE_H
struct fde_vector
{
@@ -174,3 +176,5 @@ last_fde (struct object *obj __attribute
return f->length == 0;
#endif
}
+
+#endif /* unwind-dw2-fde.h */
===================================================================
Index: unwind-pe.h
--- unwind-pe.h 8 Dec 2003 19:47:12 -0000 1.16
+++ unwind-pe.h 8 Jan 2004 07:47:10 -0000
@@ -31,6 +31,9 @@
compatibility problems with the base ABI. This is slightly better
than duplicating code, however. */
+#ifndef GCC_UNWIND_PE_H
+#define GCC_UNWIND_PE_H
+
/* If using C++, references to abort have to be qualified with std::. */
#if __cplusplus
#define __gxx_abort std::abort
@@ -284,3 +287,5 @@ read_encoded_value (struct _Unwind_Conte
}
#endif
+
+#endif /* unwind-pe.h */
===================================================================
Index: unwind.h
--- unwind.h 4 Sep 2003 10:47:45 -0000 1.13
+++ unwind.h 8 Jan 2004 07:47:10 -0000
@@ -28,6 +28,9 @@
/* This is derived from the C++ ABI for IA-64. Where we diverge
for cross-architecture compatibility are noted with "@@@". */
+#ifndef _UNWIND_H
+#define _UNWIND_H
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -225,3 +228,5 @@ extern void * _Unwind_FindEnclosingFunct
#ifdef __cplusplus
}
#endif
+
+#endif /* unwind.h */
===================================================================
Index: cp/parser.c
--- cp/parser.c 5 Jan 2004 21:07:20 -0000 1.147
+++ cp/parser.c 8 Jan 2004 07:47:10 -0000
@@ -14196,7 +14196,7 @@ cp_parser_functional_cast (cp_parser* pa
specifiers applied to the declaration. Returns the FUNCTION_DECL
for the member function. */
-tree
+static tree
cp_parser_save_member_function_body (cp_parser* parser,
tree decl_specifiers,
tree declarator,
===================================================================
Index: treelang/parse.y
--- treelang/parse.y 28 Jul 2003 04:39:29 -0000 1.10
+++ treelang/parse.y 8 Jan 2004 07:47:10 -0000
@@ -783,7 +783,7 @@ print_token (FILE * file, unsigned int t
}
/* Output a message ERROR_MESSAGE from the parser. */
-void
+static void
yyerror (const char *error_message)
{
struct prod_token_parm_item *tok;