mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-28 11:40:55 +08:00
Move pragma interface support to c-pragma.h
From-SVN: r9410
This commit is contained in:
parent
dce58868d9
commit
3d6f7931f9
@ -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
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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 */
|
||||
}
|
||||
|
@ -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 */
|
@ -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 \
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
35
gcc/varasm.c
35
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. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user