a part of the directive.
The value is a string in a reusable buffer. It remains valid
- only until the next time this function is called. */
+ only until the next time this function is called.
+
+ The terminating character ('\n' or EOF) is left in FINPUT for the
+ caller to re-read. */
char *
get_directive_line (finput)
continue;
/* Detect the end of the directive. */
- if (c == '\n' && looking_for == 0)
+ if (looking_for == 0
+ && (c == '\n' || c == EOF))
{
ungetc (c, finput);
c = '\0';
/* Lexical analyzer for C and Objective C.
- Copyright (C) 1987, 88, 89, 92, 94, 1995 Free Software Foundation, Inc.
+ Copyright (C) 1987, 88, 89, 92, 94, 95, 1996 Free Software Foundation, Inc.
This file is part of GNU CC.
return handle_sysv_pragma (finput, c);
#else /* !HANDLE_SYSV_PRAGMA */
#ifdef HANDLE_PRAGMA
- HANDLE_PRAGMA (finput);
+ HANDLE_PRAGMA (finput, c);
#endif /* HANDLE_PRAGMA */
goto skipline;
#endif /* !HANDLE_SYSV_PRAGMA */
&& ((c = getc (finput)) == ' ' || c == '\t' || c == '\n'))
{
#ifdef DWARF_DEBUGGING_INFO
- if ((debug_info_level == DINFO_LEVEL_VERBOSE)
+ if (c != '\n'
+ && (debug_info_level == DINFO_LEVEL_VERBOSE)
&& (write_symbols == DWARF_DEBUG))
dwarfout_define (lineno, get_directive_line (finput));
#endif /* DWARF_DEBUGGING_INFO */
&& ((c = getc (finput)) == ' ' || c == '\t' || c == '\n'))
{
#ifdef DWARF_DEBUGGING_INFO
- if ((debug_info_level == DINFO_LEVEL_VERBOSE)
+ if (c != '\n'
+ && (debug_info_level == DINFO_LEVEL_VERBOSE)
&& (write_symbols == DWARF_DEBUG))
dwarfout_undef (lineno, get_directive_line (finput));
#endif /* DWARF_DEBUGGING_INFO */
/* skip the rest of this line. */
skipline:
- if (c == '\n')
- return c;
- while ((c = getc (finput)) != EOF && c != '\n');
+ while (c != '\n' && c != EOF)
+ c = getc (finput);
return c;
}
\f
with this attribute may be safely used in an interrupt vector. */
int
-handle_pragma (file)
+handle_pragma (file, c)
FILE *file;
+ int c;
{
- int c;
char pbuf[20];
int psize = 0;
- c = getc (file);
while (c == ' ' || c == '\t')
c = getc (file);
- if (c == '\n' || c == EOF)
- return c;
-
- /* The only pragmas we understand are interrupt and saveall. */
- while (psize < sizeof (pbuf) - 1
- && isalpha (c))
+ if (c != '\n' & c != EOF)
{
- pbuf[psize++] = c;
- c = getc (file);
- }
- pbuf[psize] = 0;
-
- if (strcmp (pbuf, "interrupt") == 0)
- pragma_interrupt = 1;
-
- if (strcmp (pbuf, "saveall") == 0)
- pragma_saveall = 1;
-
- /* ??? This is deprecated. Delete for gcc 2.8. */
- if (strcmp (pbuf, "section") == 0)
- {
- static int printed_p = 0;
- if (!printed_p)
- {
- warning ("#pragma section is deprecated, use section attributes");
- printed_p = 1;
- }
- while (c && !isalpha (c))
- c = getc (file);
- psize = 0;
while (psize < sizeof (pbuf) - 1
- && isalpha (c) || isdigit (c) || c == '_')
+ && isalpha (c))
{
pbuf[psize++] = c;
c = getc (file);
}
pbuf[psize] = 0;
- named_section (NULL_TREE, pbuf);
+
+ if (strcmp (pbuf, "interrupt") == 0)
+ pragma_interrupt = 1;
+ else if (strcmp (pbuf, "saveall") == 0)
+ pragma_saveall = 1;
+
+ while (c != '\n' && c != EOF)
+ c = getc (file);
}
- ungetc (c, file);
+
return c;
}
\f
#define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR)
-#define HANDLE_PRAGMA(FILE) handle_pragma (FILE)
+/* Define this macro if you want to implement any pragmas. If defined, it
+ should be a C statement to be executed when #pragma is seen. The
+ argument STREAM is the stdio input stream from which the source
+ text can be read. CH is the first character after the #pragma. The
+ statement should execute a `return' with the terminating character found
+ (newline or EOF). */
+#define HANDLE_PRAGMA(FILE, CH) return handle_pragma (FILE, CH)
#define FINAL_PRESCAN_INSN(insn, operand, nop) final_prescan_insn (insn, operand,nop)
/* ??? This is incomplete, since it does not handle all pragmas that the
intel compilers understand. */
-void
-process_pragma (finput)
+int
+process_pragma (finput, c)
FILE *finput;
+ int c;
{
- int c;
int i;
- c = getc (finput);
while (c == ' ' || c == '\t')
c = getc (finput);
/* Should be pragma 'far' or equivalent for callx/balx here. */
- ungetc (c, finput);
+ while (c != '\n' && c != EOF)
+ c = getc (finput);
+ return c;
}
/* Initialize variables before compiling any files. */
fprintf (asm_out_file, "\t.type\t0x%x;", (A & 0xf) + 2 * (A & ~0xf))
/* Handle pragmas for compatibility with Intel's compilers. */
-#define HANDLE_PRAGMA(FILE) process_pragma (FILE)
+#define HANDLE_PRAGMA(FILE, CH) return process_pragma (FILE, CH)
/* Run-time compilation parameters selecting different hardware subsets. */
/* Functions for generic NeXT as target machine for GNU C compiler.
- Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
+ Copyright (C) 1989, 90-93, 1996 Free Software Foundation, Inc.
This file is part of GNU CC.
extern char *get_directive_line ();
/* Called from check_newline via the macro HANDLE_PRAGMA.
- FINPUT is the source file input stream. */
+ FINPUT is the source file input stream.
+ CH is the first character after `#pragma'.
+ The result is the terminating character ('\n' or EOF). */
-void
-handle_pragma (finput, get_line_function)
+int
+handle_pragma (finput, ch, get_line_function)
FILE *finput;
+ int ch;
char *(*get_line_function) ();
{
- register char *p = (*get_line_function) (finput);
+ register char *p;
/* Record initial setting of optimize flag, so we can restore it. */
if (!pragma_initialized)
initial_optimize_flag = optimize;
}
+ /* Nothing to do if #pragma is by itself. */
+ if (ch == '\n' || ch == EOF)
+ return ch;
+
+ p = (*get_line_function) (finput);
if (OPT_STRCMP ("CC_OPT_ON"))
{
optimize = 1, obey_regdecls = 0;
flag_writable_strings = 0;
else if (OPT_STRCMP ("CC_NO_MACH_TEXT_SECTIONS"))
flag_no_mach_text_sections = 1;
+
+ /* get_line_function must leave the last character read in FINPUT. */
+ return getc (finput);
}
/* nextstep.h -- operating system specific defines to be used when
targeting GCC for NeXTSTEP.
- Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
+ Copyright (C) 1989, 90-93, 1996 Free Software Foundation, Inc.
This file is part of GNU CC.
/* How to parse #pragma's */
#undef HANDLE_PRAGMA
-#define HANDLE_PRAGMA(finput) handle_pragma (finput, &get_directive_line)
+#define HANDLE_PRAGMA(finput, ch) \
+ return handle_pragma (finput, ch, &get_directive_line)
/* Give methods pretty symbol names on NeXT. */
/* Output routines for GCC for Hitachi Super-H.
- Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
+ Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
This file is part of GNU CC.
#include "config.h"
+#include <ctype.h>
#include <stdio.h>
#include "rtl.h"
compiler. */
int
-handle_pragma (file)
+handle_pragma (file, c)
FILE *file;
+ int c;
{
- int c;
char pbuf[200];
int psize = 0;
- c = getc (file);
while (c == ' ' || c == '\t')
c = getc (file);
- if (c == '\n' || c == EOF)
- return c;
-
- while (psize < sizeof (pbuf) - 1 && c != '\n')
+ if (c != '\n' & c != EOF)
{
- pbuf[psize++] = c;
- if (psize == 9 && strncmp (pbuf, "interrupt", 9) == 0)
- {
- pragma_interrupt = 1;
- return ' ';
- }
- if (psize == 5 && strncmp (pbuf, "trapa", 5) == 0)
- {
- pragma_interrupt = pragma_trapa = 1;
- return ' ';
- }
- if (psize == 15 && strncmp (pbuf, "nosave_low_regs", 15) == 0)
+ while (psize < sizeof (pbuf) - 1
+ && (isalpha (c) || c == '_'))
{
- pragma_nosave_low_regs = 1;
- return ' ';
+ pbuf[psize++] = c;
+ c = getc (file);
}
- c = getc (file);
+ pbuf[psize] = 0;
+
+ if (strcmp (pbuf, "interrupt") == 0)
+ pragma_interrupt = 1;
+ else if (strcmp (pbuf, "trapa") == 0)
+ pragma_interrupt = pragma_trapa = 1;
+ else if (strcmp (pbuf, "nosave_low_regs") == 0)
+ pragma_nosave_low_regs = 1;
+
+ while (c != '\n' && c != EOF)
+ c = getc (file);
}
+
return c;
}
\f
/* Definitions of target machine for GNU compiler for Hitachi Super-H.
- Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
+ Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
Contributed by Steve Chamberlain (sac@cygnus.com).
Improved by Jim Wilson (wilson@cygnus.com).
#define TARGET_MEM_FUNCTIONS
-#define HANDLE_PRAGMA(finput) return handle_pragma (finput)
+/* Define this macro if you want to implement any pragmas. If defined, it
+ should be a C statement to be executed when #pragma is seen. The
+ argument STREAM is the stdio input stream from which the source
+ text can be read. CH is the first character after the #pragma. The
+ statement should execute a `return' with the terminating character found
+ (newline or EOF). */
+#define HANDLE_PRAGMA(FILE, CH) return handle_pragma (FILE, CH)
/* Set when processing a function with pragma interrupt turned on. */