aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meissner <meissner@gcc.gnu.org>1995-04-18 18:16:51 +0000
committerMichael Meissner <meissner@gcc.gnu.org>1995-04-18 18:16:51 +0000
commit3d6f7931f91b0c782095f2acabd853ace1ec9d72 (patch)
treedb6dcc9aaea350dc8e6ad9b635b41529042f0167
parentdce58868d99177f6b266e982efd29afe53932883 (diff)
downloadgcc-3d6f7931f91b0c782095f2acabd853ace1ec9d72.zip
gcc-3d6f7931f91b0c782095f2acabd853ace1ec9d72.tar.gz
gcc-3d6f7931f91b0c782095f2acabd853ace1ec9d72.tar.bz2
Move pragma interface support to c-pragma.h
From-SVN: r9410
-rw-r--r--gcc/Makefile.in6
-rw-r--r--gcc/c-lex.c1
-rw-r--r--gcc/c-pragma.c25
-rw-r--r--gcc/c-pragma.h48
-rw-r--r--gcc/cp/Makefile.in2
-rw-r--r--gcc/cp/lex.c5
-rw-r--r--gcc/varasm.c35
7 files changed, 67 insertions, 55 deletions
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index af5a91c..6c3f170 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1022,10 +1022,10 @@ c-decl.o : c-decl.c $(CONFIG_H) $(TREE_H) c-tree.h c-lex.h flags.h output.h
c-typeck.o : c-typeck.c $(CONFIG_H) $(TREE_H) c-tree.h flags.h output.h
c-lang.o : c-lang.c $(CONFIG_H) $(TREE_H)
c-lex.o : c-lex.c $(CONFIG_H) $(TREE_H) c-lex.h c-tree.h $(srcdir)/c-parse.h \
- input.h flags.h $(srcdir)/c-gperf.h
+ input.h flags.h $(srcdir)/c-gperf.h c-pragma.h
c-aux-info.o : c-aux-info.c $(CONFIG_H) $(TREE_H) c-tree.h flags.h
c-convert.o : c-convert.c $(CONFIG_H) $(TREE_H) flags.h
-c-pragma.o: c-pragma.c $(CONFIG_H) $(TREE_H)
+c-pragma.o: c-pragma.c $(CONFIG_H) $(TREE_H) c-pragma.h
c-iterate.o: c-iterate.c $(CONFIG_H) $(TREE_H) $(RTL_H) c-tree.h flags.h
# To make a configuration always use collect2, set USE_COLLECT2 to ld.
@@ -1101,7 +1101,7 @@ rtlanal.o : rtlanal.c $(CONFIG_H) $(RTL_H)
toplev.o: bytecode.h bc-emit.h
varasm.o : varasm.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h function.h \
defaults.h insn-codes.h expr.h hard-reg-set.h regs.h xcoffout.h \
- output.h bytecode.h
+ output.h bytecode.h c-pragma.h
function.o : function.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h \
insn-flags.h insn-codes.h expr.h regs.h hard-reg-set.h insn-config.h \
recog.h output.h bytecode.h
diff --git a/gcc/c-lex.c b/gcc/c-lex.c
index 14a0af3..2c10890 100644
--- a/gcc/c-lex.c
+++ b/gcc/c-lex.c
@@ -30,6 +30,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "c-tree.h"
#include "flags.h"
#include "c-parse.h"
+#include "c-pragma.h"
#include <ctype.h>
diff --git a/gcc/c-pragma.c b/gcc/c-pragma.c
index cdade3e..13471db 100644
--- a/gcc/c-pragma.c
+++ b/gcc/c-pragma.c
@@ -22,31 +22,10 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "tree.h"
#include "function.h"
#include "defaults.h"
+#include "c-pragma.h"
#ifdef HANDLE_SYSV_PRAGMA
-/* Support #pragma weak by default if WEAK_ASM_OP and ASM_OUTPUT_DEF
- are defined. */
-#if !defined (HANDLE_PRAGMA_WEAK) && defined (WEAK_ASM_OP) && defined (ASM_OUTPUT_DEF)
-#define HANDLE_PRAGMA_WEAK 1
-#endif
-
-/* See varasm.c for an identical definition. */
-enum pragma_state
-{
- ps_start,
- ps_done,
- ps_bad,
- ps_weak,
- ps_name,
- ps_equals,
- ps_value,
- ps_pack,
- ps_left,
- ps_align,
- ps_right
-};
-
/* When structure field packing is in effect, this variable is the
number of bits to use as the maximum alignment. When packing is not
in effect, this is zero. */
@@ -82,7 +61,7 @@ handle_pragma_token (string, token)
{
#ifdef HANDLE_PRAGMA_WEAK
if (HANDLE_PRAGMA_WEAK)
- handle_pragma_weak (state, asm_out_file, name, value);
+ handle_pragma_weak (state, name, value);
#endif /* HANDLE_PRAMA_WEAK */
}
diff --git a/gcc/c-pragma.h b/gcc/c-pragma.h
index e69de29..7eaacd0 100644
--- a/gcc/c-pragma.h
+++ b/gcc/c-pragma.h
@@ -0,0 +1,48 @@
+/* Pragma related interfaces.
+ Copyright (C) 1995 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#ifdef HANDLE_SYSV_PRAGMA
+
+/* Support #pragma weak by default if WEAK_ASM_OP and ASM_OUTPUT_DEF
+ are defined. */
+#if !defined (HANDLE_PRAGMA_WEAK) && defined (WEAK_ASM_OP) && defined (ASM_OUTPUT_DEF)
+#define HANDLE_PRAGMA_WEAK 1
+#endif
+
+enum pragma_state
+{
+ ps_start,
+ ps_done,
+ ps_bad,
+ ps_weak,
+ ps_name,
+ ps_equals,
+ ps_value,
+ ps_pack,
+ ps_left,
+ ps_align,
+ ps_right
+};
+
+/* Output asm to handle ``#pragma weak'' */
+extern void handle_pragma_weak PROTO((enum pragma_state, char *, char *));
+
+/* Handle a C style pragma */
+extern void handle_pragma_token PROTO((char *, tree));
+#endif /* HANDLE_SYSV_PRAGMA */
diff --git a/gcc/cp/Makefile.in b/gcc/cp/Makefile.in
index 711985b..52f6186 100644
--- a/gcc/cp/Makefile.in
+++ b/gcc/cp/Makefile.in
@@ -222,7 +222,7 @@ $(srcdir)/hash.h:
spew.o : spew.c $(CONFIG_H) $(CXX_TREE_H) \
$(PARSE_H) $(srcdir)/../flags.h lex.h
lex.o : lex.c $(CONFIG_H) $(CXX_TREE_H) \
- $(PARSE_H) input.c $(srcdir)/../flags.h hash.h lex.h
+ $(PARSE_H) input.c $(srcdir)/../flags.h hash.h lex.h $(srcdir)/../c-pragma.h
decl.o : decl.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \
lex.h decl.h $(srcdir)/../stack.h
decl2.o : decl2.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index 2392599..fbf68e4 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -36,6 +36,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "cp-tree.h"
#include "flags.h"
#include "obstack.h"
+#include "c-pragma.h"
#ifdef MULTIBYTE_CHARS
#include <stdlib.h>
@@ -4953,10 +4954,10 @@ handle_sysv_pragma ()
handle_pragma_token (token_buffer, yylval.ttype);
break;
case END_OF_LINE:
- handle_pragma_token (0, 0);
+ handle_pragma_token (NULL_PTR, NULL_TREE);
return;
default:
- handle_pragma_token (token_buffer, 0);
+ handle_pragma_token (token_buffer, NULL_TREE);
}
}
}
diff --git a/gcc/varasm.c b/gcc/varasm.c
index d822613..4ea82fc 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -42,6 +42,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "bytecode.h"
#include "obstack.h"
+#include "c-pragma.h"
#ifdef XCOFF_DEBUGGING_INFO
#include "xcoffout.h"
@@ -97,7 +98,7 @@ int size_directive_output;
tree last_assemble_variable_decl;
-#if defined (HANDLE_PRAGMA_WEAK) || (defined (WEAK_ASM_OP) && defined (ASM_OUTPUT_DEF))
+#ifdef HANDLE_PRAGMA_WEAK
/* Any weak symbol declarations waiting to be emitted. */
struct weak_syms
@@ -3926,35 +3927,12 @@ output_constructor (exp, size)
assemble_zeros (size - total_bytes);
}
-/* Support #pragma weak by default if WEAK_ASM_OP and ASM_OUTPUT_DEF
- are defined. */
-#if !defined (HANDLE_PRAGMA_WEAK) && defined (WEAK_ASM_OP) && defined (ASM_OUTPUT_DEF)
-#define HANDLE_PRAGMA_WEAK 1
-#endif
-
#if defined (HANDLE_SYSV_PRAGMA) && defined (HANDLE_PRAGMA_WEAK)
-/* See c-pragma.c for an identical definition. */
-enum pragma_state
-{
- ps_start,
- ps_done,
- ps_bad,
- ps_weak,
- ps_name,
- ps_equals,
- ps_value,
- ps_pack,
- ps_left,
- ps_align,
- ps_right
-};
-
/* Output asm to handle ``#pragma weak'' */
void
-handle_pragma_weak (what, out_file, name, value)
+handle_pragma_weak (what, name, value)
enum pragma_state what;
- FILE *out_file;
char *name, *value;
{
if (what == ps_name || what == ps_value)
@@ -3988,12 +3966,17 @@ void
declare_weak (decl)
tree decl;
{
+#ifdef HANDLE_PRAGMA_WEAK
if (! TREE_PUBLIC (decl))
error_with_decl (decl, "weak declaration of `%s' must be public");
else
- handle_pragma_weak (ps_name, asm_out_file,
+ handle_pragma_weak (ps_name,
IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)),
NULL_PTR);
+
+#else
+ error ("weak declarations are not supported in this configuration");
+#endif
}
/* Emit any pending weak declarations. */