OSDN Git Service

Add includes for config.h, stdio.h, and flags.h.
[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, 96, 1997 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 #include "config.h"
22 #include <stdio.h>
23 #include "flags.h"
24 #include "tree.h"
25
26 /* Make everything that used to go in the text section really go there.  */
27
28 int flag_no_mach_text_sections = 0;
29
30 #define OPT_STRCMP(opt) (!strncmp (opt, p, sizeof (opt)-1))
31
32 /* 1 if handle_pragma has been called yet.  */
33
34 static int pragma_initialized;
35
36 /* Initial setting of `optimize'.  */
37
38 static int initial_optimize_flag;
39
40 extern char *get_directive_line ();
41
42 /* Called from check_newline via the macro HANDLE_PRAGMA.
43    FINPUT is the source file input stream.
44    CH is the first character after `#pragma'.
45    The result is 1 if the pragma was handled.  */
46
47 int
48 handle_pragma (finput, node)
49      FILE *finput;
50      tree node;
51 {
52   int retval = 0;
53   register char *pname;
54
55   /* Record initial setting of optimize flag, so we can restore it.  */
56   if (!pragma_initialized)
57     {
58       pragma_initialized = 1;
59       initial_optimize_flag = optimize;
60     }
61
62   if (TREE_CODE (node) != IDENTIFIER_NODE)
63     return 0;
64
65   pname = IDENTIFIER_POINTER (node);
66
67   if (strcmp (pname, "CC_OPT_ON") == 0)
68     {
69       optimize = 1, obey_regdecls = 0;
70       warning ("optimization turned on");
71       retval = 1;
72     }
73   else if (strcmp (pname, "CC_OPT_OFF") == 0)
74     {
75       optimize = 0, obey_regdecls = 1;
76       warning ("optimization turned off");
77       retval = 1;
78     }
79   else if (strcmp (pname, "CC_OPT_RESTORE") == 0)
80     {
81       extern int initial_optimize_flag;
82
83       if (optimize != initial_optimize_flag)
84         {
85           if (initial_optimize_flag)
86             obey_regdecls = 0;
87           else
88             obey_regdecls = 1;
89           optimize = initial_optimize_flag;
90         }
91       warning ("optimization level restored");
92       retval = 1;
93     }
94   else if (strcmp (pname, "CC_WRITABLE_STRINGS") == 0)
95     flag_writable_strings = retval = 1;
96   else if (strcmp (pname, "CC_NON_WRITABLE_STRINGS") == 0)
97     flag_writable_strings = 0, retval = 1;
98   else if (strcmp (pname, "CC_NO_MACH_TEXT_SECTIONS") == 0)
99     flag_no_mach_text_sections = retval = 1;
100
101   return retval;
102 }