typedef token_kind_t as int
[cparser] / preprocessor.c
index b50f70a..af95d90 100644 (file)
@@ -99,7 +99,7 @@ static const char       *printed_input_name = NULL;
 static source_position_t expansion_pos;
 static pp_definition_t  *current_expansion  = NULL;
 static strset_t          stringset;
-static preprocessor_token_kind_t last_token;
+static token_kind_t      last_token;
 
 static searchpath_entry_t *searchpath;
 
@@ -460,7 +460,9 @@ static string_t sym_make_string(string_encoding_t const enc)
        return (string_t){ result, len, enc };
 }
 
-static void parse_string(utf32 const delimiter, preprocessor_token_kind_t const kind, string_encoding_t const enc, char const *const context)
+static void parse_string(utf32 const delimiter, token_kind_t const kind,
+                         string_encoding_t const enc,
+                         char const *const context)
 {
        const unsigned start_linenr = input.position.lineno;
 
@@ -738,10 +740,10 @@ static void skip_whitespace(void)
        }
 }
 
-static void eat_pp(preprocessor_token_kind_t const type)
+static inline void eat_pp(token_kind_t const kind)
 {
-       (void) type;
-       assert(pp_token.kind == type);
+       assert(pp_token.kind == kind);
+       (void) kind;
        next_preprocessing_token();
 }
 
@@ -1024,7 +1026,6 @@ restart:
        case '~':
        case ';':
        case ',':
-       case '\\':
                pp_token.kind = input.c;
                next_char();
                return;
@@ -1340,16 +1341,16 @@ static void parse_undef_directive(void)
        eat_pp_directive();
 }
 
+/** behind an #include we can have the special headername lexems.
+ * They're only allowed behind an #include so they're not recognized
+ * by the normal next_preprocessing_token. We handle them as a special
+ * exception here */
 static void parse_headername(void)
 {
        const source_position_t start_position = input.position;
        string_t                string         = { NULL, 0, STRING_ENCODING_CHAR };
        assert(obstack_object_size(&symbol_obstack) == 0);
 
-       /* behind an #include we can have the special headername lexems.
-        * They're only allowed behind an #include so they're not recognized
-        * by the normal next_preprocessing_token. We handle them as a special
-        * exception here */
        if (info.at_line_begin) {
                parse_error("expected headername after #include");
                goto finish_error;
@@ -1597,7 +1598,7 @@ static void parse_else_directive(void)
        if (conditional->in_else) {
                errorf(&pp_token.base.source_position,
                       "#else after #else (condition started %P)",
-                      conditional->source_position);
+                      &conditional->source_position);
                skip_mode = true;
                return;
        }