OSDN Git Service

* c-lex.c (check_newline): Pass character after `#pragma' to
[pf3gnuchains/gcc-fork.git] / gcc / config / nextstep.c
1 /* Functions for generic NeXT as target machine for GNU C compiler.
2    Copyright (C) 1989, 90-93, 1996 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING.  If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.  */
20
21 /* Make everything that used to go in the text section really go there.  */
22
23 int flag_no_mach_text_sections = 0;
24
25 #define OPT_STRCMP(opt) (!strncmp (opt, p, sizeof (opt)-1))
26
27 /* 1 if handle_pragma has been called yet.  */
28
29 static int pragma_initialized;
30
31 /* Initial setting of `optimize'.  */
32
33 static int initial_optimize_flag;
34
35 extern char *get_directive_line ();
36
37 /* Called from check_newline via the macro HANDLE_PRAGMA.
38    FINPUT is the source file input stream.
39    CH is the first character after `#pragma'.
40    The result is the terminating character ('\n' or EOF).  */
41
42 int
43 handle_pragma (finput, ch, get_line_function)
44      FILE *finput;
45      int ch;
46      char *(*get_line_function) ();
47 {
48   register char *p;
49
50   /* Record initial setting of optimize flag, so we can restore it.  */
51   if (!pragma_initialized)
52     {
53       pragma_initialized = 1;
54       initial_optimize_flag = optimize;
55     }
56
57   /* Nothing to do if #pragma is by itself.  */
58   if (ch == '\n' || ch == EOF)
59     return ch;
60
61   p = (*get_line_function) (finput);
62   if (OPT_STRCMP ("CC_OPT_ON"))
63     {
64       optimize = 1, obey_regdecls = 0;
65       warning ("optimization turned on");
66     }
67   else if (OPT_STRCMP ("CC_OPT_OFF"))
68     {
69       optimize = 0, obey_regdecls = 1;
70       warning ("optimization turned off");
71     }
72   else if (OPT_STRCMP ("CC_OPT_RESTORE"))
73     {
74       extern int initial_optimize_flag;
75
76       if (optimize != initial_optimize_flag)
77         {
78           if (initial_optimize_flag)
79             obey_regdecls = 0;
80           else
81             obey_regdecls = 1;
82           optimize = initial_optimize_flag;
83         }
84       warning ("optimization level restored");
85     }
86   else if (OPT_STRCMP ("CC_WRITABLE_STRINGS"))
87     flag_writable_strings = 1;
88   else if (OPT_STRCMP ("CC_NON_WRITABLE_STRINGS"))
89     flag_writable_strings = 0;
90   else if (OPT_STRCMP ("CC_NO_MACH_TEXT_SECTIONS"))
91     flag_no_mach_text_sections = 1;
92
93   /* get_line_function must leave the last character read in FINPUT.  */
94   return getc (finput);
95 }