OSDN Git Service

* cppexp.c, cpphash.c, cpphash.h, cpplex.c, cpplib.c,
[pf3gnuchains/gcc-fork.git] / gcc / cpphash.h
index 704cab4..a23aa87 100644 (file)
@@ -91,14 +91,14 @@ enum node_type
   T_FILE,         /* `__FILE__' */
   T_BASE_FILE,    /* `__BASE_FILE__' */
   T_INCLUDE_LEVEL, /* `__INCLUDE_LEVEL__' */
-  T_VERSION,      /* `__VERSION__' */
   T_TIME,         /* `__TIME__' */
   T_STDC,         /* `__STDC__' */
   T_CONST,        /* Constant string, used by `__SIZE_TYPE__' etc */
+  T_MCONST,       /* Ditto, but the string is malloced memory */
   T_MACRO,        /* macro defined by `#define' */
   T_DISABLED,     /* macro temporarily turned off for rescan */
   T_POISON,       /* macro defined with `#pragma poison' */
-  T_UNUSED        /* Used for something not defined.  */
+  T_EMPTY         /* macro defined to nothing */
 };
 
 /* different kinds of things that can appear in the value field
@@ -172,7 +172,7 @@ typedef struct ihash IHASH;
 #define IShspace       0x08    /* ' ' \t \f \v */
 #define ISspace                0x10    /* ' ' \t \f \v \n */
 
-#define _dollar_ok(x)  ((x) == '$' && CPP_OPTIONS (pfile)->dollars_in_ident)
+#define _dollar_ok(x)  ((x) == '$' && CPP_OPTION (pfile, dollars_in_ident))
 
 #define is_idchar(x)   ((_cpp_IStable[x] & ISidnum) || _dollar_ok(x))
 #define is_idstart(x)  ((_cpp_IStable[x] & ISidstart) || _dollar_ok(x))
@@ -192,11 +192,11 @@ extern unsigned char _cpp_IStable[256];
 
 /* Macros.  */
 
+/* One character lookahead in the input buffer.  Note that if this
+   returns EOF, it does *not* necessarily mean the file's end has been
+   reached.  */
 #define CPP_BUF_PEEK(BUFFER) \
   ((BUFFER)->cur < (BUFFER)->rlimit ? *(BUFFER)->cur : EOF)
-#define CPP_BUF_GET(BUFFER) \
-  ((BUFFER)->cur < (BUFFER)->rlimit ? *(BUFFER)->cur++ : EOF)
-#define CPP_FORWARD(BUFFER, N) ((BUFFER)->cur += (N))
 
 /* Make sure PFILE->token_buffer has space for at least N more characters. */
 #define CPP_RESERVE(PFILE, N) \
@@ -221,16 +221,27 @@ extern unsigned char _cpp_IStable[256];
 #define CPP_BUMP_BUFFER_LINE(PBUF) ((PBUF)->lineno++,\
                                    (PBUF)->line_base = (PBUF)->cur)
 #define CPP_BUMP_LINE(PFILE) CPP_BUMP_BUFFER_LINE(CPP_BUFFER(PFILE))
+#define CPP_BUMP_BUFFER_LINE_CUR(PBUF, CUR) ((PBUF)->lineno++,\
+                                            (PBUF)->line_base = CUR)
+#define CPP_BUMP_LINE_CUR(PFILE, CUR) \
+                            CPP_BUMP_BUFFER_LINE_CUR(CPP_BUFFER(PFILE), CUR)
 #define CPP_PREV_BUFFER(BUFFER) ((BUFFER)->prev)
 
-#define CPP_PRINT_DEPS(PFILE) (CPP_OPTIONS (PFILE)->print_deps)
-#define CPP_TRADITIONAL(PFILE) (CPP_OPTIONS(PFILE)->traditional)
+/* Are we in column 1 right now?  Used mainly for -traditional handling
+   of directives.  */
+#define CPP_IN_COLUMN_1(PFILE) \
+(CPP_BUFFER (PFILE)->cur - CPP_BUFFER (PFILE)->line_base == 1)
+
+#define CPP_PRINT_DEPS(PFILE) CPP_OPTION (PFILE, print_deps)
+#define CPP_TRADITIONAL(PFILE) CPP_OPTION (PFILE, traditional)
 #define CPP_PEDANTIC(PFILE) \
-  (CPP_OPTIONS (PFILE)->pedantic && !CPP_BUFFER (pfile)->system_header_p)
+  (CPP_OPTION (PFILE, pedantic) && !CPP_BUFFER (PFILE)->system_header_p)
+#define CPP_WTRADITIONAL(PF) \
+  (CPP_OPTION (PF, warn_traditional) && !CPP_BUFFER (PF)->system_header_p)
 
 /* CPP_IS_MACRO_BUFFER is true if the buffer contains macro expansion.
    (Note that it is false while we're expanding macro *arguments*.) */
-#define CPP_IS_MACRO_BUFFER(PBUF) ((PBUF)->data != NULL)
+#define CPP_IS_MACRO_BUFFER(PBUF) ((PBUF)->macro != NULL)
 
 /* Remember the current position of PFILE so it may be returned to
    after looking ahead a bit.
@@ -239,14 +250,18 @@ extern unsigned char _cpp_IStable[256];
    may not forget about it and continue parsing.  You may not pop a
    buffer with an active mark.  You may not call CPP_BUMP_LINE while a
    mark is active.  */
-#define CPP_SET_BUF_MARK(IP)   ((IP)->mark = (IP)->cur - (IP)->buf)
-#define CPP_GOTO_BUF_MARK(IP)  ((IP)->cur = (IP)->buf + (IP)->mark, \
-                               (IP)->mark = -1)
+#define CPP_SET_BUF_MARK(IP)   ((IP)->mark = (IP)->cur)
+#define CPP_GOTO_BUF_MARK(IP)  ((IP)->cur = (IP)->mark,        (IP)->mark = 0)
 #define CPP_SET_MARK(PFILE)  CPP_SET_BUF_MARK(CPP_BUFFER(PFILE))
 #define CPP_GOTO_MARK(PFILE) CPP_GOTO_BUF_MARK(CPP_BUFFER(PFILE))
 
 /* ACTIVE_MARK_P is true if there's a live mark in the buffer.  */
-#define ACTIVE_MARK_P(PFILE) (CPP_BUFFER (PFILE)->mark != -1)
+#define ACTIVE_MARK_P(PFILE) (CPP_BUFFER (PFILE)->mark != 0)
+
+/* Are mark and point adjacent characters?  Used mostly to deal with
+   the somewhat annoying semantic of #define.  */
+#define ADJACENT_TO_MARK(PFILE) \
+ (CPP_BUFFER(PFILE)->cur - CPP_BUFFER(PFILE)->mark == 1)
 
 /* Last arg to output_line_command.  */
 enum file_change_code {same_file, rename_file, enter_file, leave_file};
@@ -255,6 +270,7 @@ enum file_change_code {same_file, rename_file, enter_file, leave_file};
 extern HASHNODE *_cpp_make_hashnode    PARAMS ((const U_CHAR *, size_t,
                                                 enum node_type,
                                                 unsigned long));
+extern unsigned int _cpp_calc_hash     PARAMS ((const U_CHAR *, size_t));
 extern HASHNODE *_cpp_lookup           PARAMS ((cpp_reader *,
                                                 const U_CHAR *, int));
 extern HASHNODE **_cpp_lookup_slot     PARAMS ((cpp_reader *,
@@ -286,12 +302,14 @@ extern void _cpp_parse_name               PARAMS ((cpp_reader *, int));
 extern void _cpp_skip_rest_of_line     PARAMS ((cpp_reader *));
 extern void _cpp_skip_hspace           PARAMS ((cpp_reader *));
 extern int _cpp_parse_assertion                PARAMS ((cpp_reader *));
-extern enum cpp_token _cpp_lex_token   PARAMS ((cpp_reader *));
+extern enum cpp_ttype _cpp_lex_token   PARAMS ((cpp_reader *));
 extern long _cpp_read_and_prescan      PARAMS ((cpp_reader *, cpp_buffer *,
                                                 int, size_t));
 extern void _cpp_init_input_buffer     PARAMS ((cpp_reader *));
 extern void _cpp_grow_token_buffer     PARAMS ((cpp_reader *, long));
-extern enum cpp_token _cpp_get_directive_token
+extern enum cpp_ttype _cpp_get_directive_token
+                                       PARAMS ((cpp_reader *));
+extern enum cpp_ttype _cpp_get_define_token
                                        PARAMS ((cpp_reader *));
 
 /* In cpplib.c */