Commit 3d6f7931 by Michael Meissner

Move pragma interface support to c-pragma.h

From-SVN: r9410
parent dce58868
...@@ -1022,10 +1022,10 @@ c-decl.o : c-decl.c $(CONFIG_H) $(TREE_H) c-tree.h c-lex.h flags.h output.h ...@@ -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-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-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 \ 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-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-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 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. # To make a configuration always use collect2, set USE_COLLECT2 to ld.
...@@ -1101,7 +1101,7 @@ rtlanal.o : rtlanal.c $(CONFIG_H) $(RTL_H) ...@@ -1101,7 +1101,7 @@ rtlanal.o : rtlanal.c $(CONFIG_H) $(RTL_H)
toplev.o: bytecode.h bc-emit.h toplev.o: bytecode.h bc-emit.h
varasm.o : varasm.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h function.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 \ 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 \ 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 \ insn-flags.h insn-codes.h expr.h regs.h hard-reg-set.h insn-config.h \
recog.h output.h bytecode.h recog.h output.h bytecode.h
......
...@@ -30,6 +30,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -30,6 +30,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "c-tree.h" #include "c-tree.h"
#include "flags.h" #include "flags.h"
#include "c-parse.h" #include "c-parse.h"
#include "c-pragma.h"
#include <ctype.h> #include <ctype.h>
......
...@@ -22,31 +22,10 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -22,31 +22,10 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "tree.h" #include "tree.h"
#include "function.h" #include "function.h"
#include "defaults.h" #include "defaults.h"
#include "c-pragma.h"
#ifdef HANDLE_SYSV_PRAGMA #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 /* When structure field packing is in effect, this variable is the
number of bits to use as the maximum alignment. When packing is not number of bits to use as the maximum alignment. When packing is not
in effect, this is zero. */ in effect, this is zero. */
...@@ -82,7 +61,7 @@ handle_pragma_token (string, token) ...@@ -82,7 +61,7 @@ handle_pragma_token (string, token)
{ {
#ifdef HANDLE_PRAGMA_WEAK #ifdef HANDLE_PRAGMA_WEAK
if (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 */ #endif /* HANDLE_PRAMA_WEAK */
} }
......
/* 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 */
...@@ -222,7 +222,7 @@ $(srcdir)/hash.h: ...@@ -222,7 +222,7 @@ $(srcdir)/hash.h:
spew.o : spew.c $(CONFIG_H) $(CXX_TREE_H) \ spew.o : spew.c $(CONFIG_H) $(CXX_TREE_H) \
$(PARSE_H) $(srcdir)/../flags.h lex.h $(PARSE_H) $(srcdir)/../flags.h lex.h
lex.o : lex.c $(CONFIG_H) $(CXX_TREE_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 \ decl.o : decl.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \
lex.h decl.h $(srcdir)/../stack.h lex.h decl.h $(srcdir)/../stack.h
decl2.o : decl2.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \ decl2.o : decl2.c $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h \
......
...@@ -36,6 +36,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -36,6 +36,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "cp-tree.h" #include "cp-tree.h"
#include "flags.h" #include "flags.h"
#include "obstack.h" #include "obstack.h"
#include "c-pragma.h"
#ifdef MULTIBYTE_CHARS #ifdef MULTIBYTE_CHARS
#include <stdlib.h> #include <stdlib.h>
...@@ -4953,10 +4954,10 @@ handle_sysv_pragma () ...@@ -4953,10 +4954,10 @@ handle_sysv_pragma ()
handle_pragma_token (token_buffer, yylval.ttype); handle_pragma_token (token_buffer, yylval.ttype);
break; break;
case END_OF_LINE: case END_OF_LINE:
handle_pragma_token (0, 0); handle_pragma_token (NULL_PTR, NULL_TREE);
return; return;
default: default:
handle_pragma_token (token_buffer, 0); handle_pragma_token (token_buffer, NULL_TREE);
} }
} }
} }
......
...@@ -42,6 +42,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -42,6 +42,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "bytecode.h" #include "bytecode.h"
#include "obstack.h" #include "obstack.h"
#include "c-pragma.h"
#ifdef XCOFF_DEBUGGING_INFO #ifdef XCOFF_DEBUGGING_INFO
#include "xcoffout.h" #include "xcoffout.h"
...@@ -97,7 +98,7 @@ int size_directive_output; ...@@ -97,7 +98,7 @@ int size_directive_output;
tree last_assemble_variable_decl; 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. */ /* Any weak symbol declarations waiting to be emitted. */
struct weak_syms struct weak_syms
...@@ -3926,35 +3927,12 @@ output_constructor (exp, size) ...@@ -3926,35 +3927,12 @@ output_constructor (exp, size)
assemble_zeros (size - total_bytes); 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) #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'' */ /* Output asm to handle ``#pragma weak'' */
void void
handle_pragma_weak (what, out_file, name, value) handle_pragma_weak (what, name, value)
enum pragma_state what; enum pragma_state what;
FILE *out_file;
char *name, *value; char *name, *value;
{ {
if (what == ps_name || what == ps_value) if (what == ps_name || what == ps_value)
...@@ -3988,12 +3966,17 @@ void ...@@ -3988,12 +3966,17 @@ void
declare_weak (decl) declare_weak (decl)
tree decl; tree decl;
{ {
#ifdef HANDLE_PRAGMA_WEAK
if (! TREE_PUBLIC (decl)) if (! TREE_PUBLIC (decl))
error_with_decl (decl, "weak declaration of `%s' must be public"); error_with_decl (decl, "weak declaration of `%s' must be public");
else else
handle_pragma_weak (ps_name, asm_out_file, handle_pragma_weak (ps_name,
IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)), IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)),
NULL_PTR); NULL_PTR);
#else
error ("weak declarations are not supported in this configuration");
#endif
} }
/* Emit any pending weak declarations. */ /* Emit any pending weak declarations. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment