Matthias Braun [Mon, 21 May 2012 23:58:52 +0000 (01:58 +0200)]
implement macro calling
Matthias Braun [Sat, 19 May 2012 14:28:29 +0000 (16:28 +0200)]
move sym_anonymous to symbol.h
Matthias Braun [Sun, 27 May 2012 22:10:21 +0000 (00:10 +0200)]
preprocessor: scanning for :: token was missing
Matthias Braun [Fri, 25 May 2012 16:29:50 +0000 (18:29 +0200)]
always set symbol for non-literal tokens
This now also allows to differentiate digraphs from their replacement in
the preprocessor output
Christoph Mallon [Wed, 20 Jun 2012 13:56:15 +0000 (15:56 +0200)]
Simplify MAYBE macros.
Christoph Mallon [Wed, 20 Jun 2012 13:43:28 +0000 (15:43 +0200)]
Correct indentation.
Christoph Mallon [Wed, 20 Jun 2012 14:58:05 +0000 (16:58 +0200)]
Turn T_EOF into a properly registered token.
Christoph Mallon [Wed, 20 Jun 2012 15:37:18 +0000 (17:37 +0200)]
Rewrite print_token().
Matthias Braun [Fri, 25 May 2012 17:59:03 +0000 (19:59 +0200)]
preprocessor: keep unknown chars in preproc mode
Christoph Mallon [Wed, 20 Jun 2012 12:09:40 +0000 (14:09 +0200)]
Remove the unused return value from parse_include_directive().
Christoph Mallon [Wed, 20 Jun 2012 10:16:04 +0000 (12:16 +0200)]
Replace !is_ifndef by is_ifdef.
Christoph Mallon [Wed, 20 Jun 2012 10:14:09 +0000 (12:14 +0200)]
Add eat_token() for more clarity in the preprocessor.
Matthias Braun [Mon, 28 May 2012 15:44:21 +0000 (17:44 +0200)]
rework preprocessor token number
We now use the "normal" token numbers where possible, special preprocessor token
numbers are only used to disambiguate between directives. This change was also
necessary because preprocessing directive identifiers are not reserved keywords.
Christoph Mallon [Wed, 20 Jun 2012 12:10:06 +0000 (14:10 +0200)]
Move the skip_mode test into parse_*_directive().
Matthias Braun [Mon, 18 Jun 2012 22:54:32 +0000 (00:54 +0200)]
fix warning
Christoph Mallon [Sun, 17 Jun 2012 15:18:44 +0000 (17:18 +0200)]
Reduce code duplication in obstack_grow_utf8().
Matthias Braun [Sun, 27 May 2012 21:44:25 +0000 (23:44 +0200)]
rename obstack_grow_symbol=>obstack_grow_utf8
This is more logical name since we don't put symbol_t on the obstack but a
unicode character in utf8 encoding.
Matthias Braun [Fri, 25 May 2012 17:45:46 +0000 (19:45 +0200)]
fix error output for unknown non-ascii characters
Matthias Braun [Fri, 25 May 2012 15:51:08 +0000 (17:51 +0200)]
typedef token_kind_t as int
The enum was renamed to token_kind_tag_t, because extensions like the
ast-grep branch can register additional tokens. This also avoids
warnings, because we have a clearly defined type for the enum now.
Matthias Braun [Sun, 3 Jun 2012 14:00:21 +0000 (16:00 +0200)]
preprocessor: backslash is not a punctuator token
Matthias Braun [Tue, 22 May 2012 14:29:40 +0000 (16:29 +0200)]
move docu in front of function
Matthias Braun [Tue, 29 May 2012 20:54:50 +0000 (22:54 +0200)]
fix bad argument to errorf
Matthias Braun [Wed, 23 May 2012 19:20:25 +0000 (21:20 +0200)]
fix warnings
Christoph Mallon [Sun, 17 Jun 2012 13:00:43 +0000 (15:00 +0200)]
Change multi-case macros so their usage looks like ordinary case labels.
Christoph Mallon [Sun, 17 Jun 2012 11:51:56 +0000 (13:51 +0200)]
Let the lexer produce preprocessor numbers T_NUMBER instead of T_INTEGER and T_FLOATINGPOINT.
Handle the details of parsing a number in the parser.
Matthias Braun [Fri, 15 Jun 2012 19:59:20 +0000 (21:59 +0200)]
adapt to latest libfirm
Matthias Braun [Thu, 17 May 2012 16:53:48 +0000 (18:53 +0200)]
remove unnecessary include
because fluffy is reusing the code and doesn't have the header.
Christoph Mallon [Thu, 14 Jun 2012 17:55:54 +0000 (19:55 +0200)]
Simplify printing string initializers.
They use value initializers internally.
Christoph Mallon [Thu, 14 Jun 2012 17:12:01 +0000 (19:12 +0200)]
Include string encoding in string_t.
Christoph Mallon [Thu, 14 Jun 2012 17:00:05 +0000 (19:00 +0200)]
Push finishing the string into make_string()/identify_string() and rename them to sym_make_string().
This resolves some instances where \0 was erroneously counted towards the string length.
Christoph Mallon [Thu, 14 Jun 2012 09:06:38 +0000 (11:06 +0200)]
Use initializer_value_t for INITIALIZER_STRING, too.
This way we do not lose the location information of the string.
Christoph Mallon [Thu, 14 Jun 2012 08:12:57 +0000 (10:12 +0200)]
Simplify print_compound_type().
Christoph Mallon [Thu, 14 Jun 2012 08:07:29 +0000 (10:07 +0200)]
Reformat intern_print_type_pre() for better readability.
Christoph Mallon [Thu, 14 Jun 2012 07:59:08 +0000 (09:59 +0200)]
Push the test for the error type in types_compatible() down to the end.
Christoph Mallon [Thu, 14 Jun 2012 07:56:20 +0000 (09:56 +0200)]
Use is_type_compound().
Christoph Mallon [Wed, 13 Jun 2012 18:58:12 +0000 (20:58 +0200)]
Remove an unnecessary goto.
Christoph Mallon [Wed, 13 Jun 2012 14:05:46 +0000 (16:05 +0200)]
Remove wrong test from is_string_type(): Pointers are not string types.
Christoph Mallon [Wed, 13 Jun 2012 14:03:01 +0000 (16:03 +0200)]
Simplify test for string initializers in initializer_from_expression().
Christoph Mallon [Wed, 13 Jun 2012 10:37:01 +0000 (12:37 +0200)]
Consistently use get_string_len() to correct the size calculation of wide string literals.
Christoph Mallon [Wed, 13 Jun 2012 10:27:46 +0000 (12:27 +0200)]
Add missing include guards.
Christoph Mallon [Wed, 13 Jun 2012 08:46:17 +0000 (10:46 +0200)]
Merge INITIALIZER_WIDE_STRING into INITIALIZER_STRING.
Christoph Mallon [Wed, 13 Jun 2012 07:45:40 +0000 (09:45 +0200)]
Remove redundant assignments to curr_pos.
diagnosticposvf() handles this.
Christoph Mallon [Wed, 13 Jun 2012 07:40:55 +0000 (09:40 +0200)]
Simplify assertions and remove redundant ones.
Christoph Mallon [Wed, 13 Jun 2012 07:00:10 +0000 (09:00 +0200)]
Remove the write-only variable diagnostic_count.
Christoph Mallon [Wed, 13 Jun 2012 06:58:09 +0000 (08:58 +0200)]
Make diagnosticvf() slightly more efficient by using fwrite() instead of printing one character at a time.
Christoph Mallon [Sun, 13 May 2012 11:18:25 +0000 (13:18 +0200)]
Remove the unused TP_PUNCTUATOR.
Christoph Mallon [Tue, 5 Jun 2012 06:35:47 +0000 (08:35 +0200)]
Remove the unused field value from struct funcname_expression_t.
Christoph Mallon [Wed, 23 May 2012 18:33:01 +0000 (20:33 +0200)]
Merge EXPR_LITERAL_WIDE_CHARACTER into EXPR_LITERAL_CHARACTER.
Christoph Mallon [Wed, 23 May 2012 17:36:18 +0000 (19:36 +0200)]
Use struct string_literal_expression_t instead of struct literal_expression_t for character literals.
Christoph Mallon [Wed, 23 May 2012 19:19:09 +0000 (21:19 +0200)]
Augment MATCH_NEWLINE() in the preprocessor so its usage looks like an ordinary case label.
Christoph Mallon [Wed, 23 May 2012 19:42:26 +0000 (21:42 +0200)]
Reduce code duplication in parse_headername().
- Correct the error message, when the closing '"' is missing.
Christoph Mallon [Wed, 23 May 2012 19:06:56 +0000 (21:06 +0200)]
Merge the implementations of parse_character_constant() and parse_string_literal().
- parse_character_constant() now honors resolve_escape_sequences.
- TP_STRING_LITERAL does not include the terminating NUL in its size anymore.
Christoph Mallon [Wed, 23 May 2012 18:49:45 +0000 (20:49 +0200)]
Merge TP_WIDE_CHARACTER_CONSTANT into TP_CHARACTER_CONSTANT.
- TP_CHARACTER_CONSTANT does not include the terminating NUL in its size anymore (TP_WIDE_CHARACTER_CONSTANT did this already).
- TP_CHARACTER_CONSTANT now includes all bytes of an extended char, not just its lowest.
Christoph Mallon [Wed, 23 May 2012 18:43:47 +0000 (20:43 +0200)]
Merge TP_WIDE_STRING_LITERAL into TP_STRING_LITERAL.
Christoph Mallon [Wed, 23 May 2012 18:33:49 +0000 (20:33 +0200)]
Remove the unused T_WIDE_CHARACTER_CONSTANT.
Christoph Mallon [Wed, 23 May 2012 07:50:54 +0000 (09:50 +0200)]
Parse universal character names.
Christoph Mallon [Wed, 23 May 2012 07:44:42 +0000 (09:44 +0200)]
Implement %0*X in diagnosticvf().
Christoph Mallon [Wed, 23 May 2012 05:29:01 +0000 (07:29 +0200)]
Turn __FUNCTION__ into an alias for __func__.
Christoph Mallon [Tue, 22 May 2012 19:42:56 +0000 (21:42 +0200)]
Remove the unused function expression_is_variable().
Christoph Mallon [Tue, 22 May 2012 16:05:07 +0000 (18:05 +0200)]
Improve error recovery in parse_asm_statement().
Christoph Mallon [Tue, 22 May 2012 15:47:46 +0000 (17:47 +0200)]
Do error recovery if parse_string_literals() is called while not at a string literal (before it did random stuff).
Christoph Mallon [Tue, 22 May 2012 15:47:08 +0000 (17:47 +0200)]
Factorise code to skip till a given token kind.
Christoph Mallon [Tue, 22 May 2012 12:53:18 +0000 (14:53 +0200)]
Augment MATCH_NEWLINE() so its usage looks like an ordinary case label.
Christoph Mallon [Tue, 22 May 2012 12:16:41 +0000 (14:16 +0200)]
Merge parsing character and string literals.
Christoph Mallon [Tue, 22 May 2012 09:02:16 +0000 (11:02 +0200)]
Do not include the terminating \0 in the size of T_STRING_LITERAL.
Christoph Mallon [Tue, 22 May 2012 08:47:16 +0000 (10:47 +0200)]
Record the encoding in string_literal_expression_t and merge EXPR_WIDE_STRING_LITERAL into EXPR_STRING_LITERAL.
Christoph Mallon [Tue, 22 May 2012 08:42:46 +0000 (10:42 +0200)]
Remove ir_type_const_char and use ir_type_char instead.
Christoph Mallon [Mon, 21 May 2012 10:51:28 +0000 (12:51 +0200)]
Correct several uses of expr->literal to expr->string_literal.
This was harmless, because the accessed field (value) has the same offset in both structs.
Christoph Mallon [Mon, 21 May 2012 06:43:24 +0000 (08:43 +0200)]
Merge T_WIDE_CHARACTER_CONSTANT into T_CHARACTER_CONSTANT.
Christoph Mallon [Mon, 21 May 2012 06:29:49 +0000 (08:29 +0200)]
Add the field encoding to struct string_literal_t and merge T_WIDE_STRING_LITERAL into T_STRING_LITERAL.
Christoph Mallon [Mon, 21 May 2012 05:37:23 +0000 (07:37 +0200)]
Rework string literal concatenation.
- Now it is linear in the number of strings instead of quadratic.
- "" L"" "" incorrectly resulted in a normal string.
- When a plain string is expected, produce a better error message if a wide string is encountered.
Christoph Mallon [Sun, 20 May 2012 16:56:15 +0000 (18:56 +0200)]
Rename [LR]BRACE to [LR]PAREN.
"Brace" usually refers to curly braces.
Christoph Mallon [Sun, 20 May 2012 16:54:31 +0000 (18:54 +0200)]
Correct confusion of token mames: L designates an opening parenthesis, R a closing one.
Christoph Mallon [Sun, 20 May 2012 16:53:23 +0000 (18:53 +0200)]
Do not crash if the expression of an array designator is not constant.
Christoph Mallon [Sun, 20 May 2012 07:28:26 +0000 (09:28 +0200)]
Improve error recovery in get_label().
Christoph Mallon [Sun, 20 May 2012 06:33:52 +0000 (08:33 +0200)]
In parse_namespace_definition() always discard the found entity when it is not a namespace, not only when it is in the current scope, too.
Christoph Mallon [Sun, 20 May 2012 06:15:04 +0000 (08:15 +0200)]
Correct off-by-one-token error in parse_namespace_definition().
Christoph Mallon [Sun, 20 May 2012 06:07:38 +0000 (08:07 +0200)]
Improve error recovery in parse_local_label_declaration().
Christoph Mallon [Sun, 20 May 2012 06:03:21 +0000 (08:03 +0200)]
Remove redundant assignment of the source position.
Christoph Mallon [Sun, 20 May 2012 05:57:32 +0000 (07:57 +0200)]
Reduce code duplication in parse_compare_builtin().
Christoph Mallon [Sun, 20 May 2012 05:51:15 +0000 (07:51 +0200)]
Reduce code duplication for parsing __func__ and friends.
Christoph Mallon [Sat, 19 May 2012 10:35:34 +0000 (12:35 +0200)]
Improve error recovery by adding anchor tokens earlier.
Christoph Mallon [Sat, 19 May 2012 10:33:24 +0000 (12:33 +0200)]
Prefer eat(token) over next_token().
Christoph Mallon [Sat, 19 May 2012 10:29:24 +0000 (12:29 +0200)]
Prefer HERE over &token.base.source_position.
Christoph Mallon [Sat, 19 May 2012 07:18:48 +0000 (09:18 +0200)]
Check for dangling % in format strings after consuming modifiers.
Christoph Mallon [Fri, 18 May 2012 20:48:35 +0000 (22:48 +0200)]
Improve -Wformat warning message: Show the expected type.
Christoph Mallon [Fri, 18 May 2012 20:59:28 +0000 (22:59 +0200)]
Correct expected type in check_scanf_format().
The listed types must be the pointed-to types.
Christoph Mallon [Thu, 17 May 2012 18:14:26 +0000 (20:14 +0200)]
Correct typo in comment.
Christoph Mallon [Thu, 17 May 2012 17:52:56 +0000 (19:52 +0200)]
Do not report an error, if the second argument to __builtin_va_start() has error type.
Christoph Mallon [Thu, 17 May 2012 17:42:22 +0000 (19:42 +0200)]
Do not silenty create an error expression, if the second argument of __builtin_va_start() is not a reference expression, but report an error.
Christoph Mallon [Thu, 17 May 2012 17:03:02 +0000 (19:03 +0200)]
Report an error if __builtin_va_start() is used in a non-variadic function, even if its second argument is not a reference expression.
Also show the position of __builtin_va_start, not its second argument, as the location of the error.
Christoph Mallon [Thu, 17 May 2012 16:57:48 +0000 (18:57 +0200)]
Do not crash, when __builtin_va_start() is used outside of a function and report an error instead.
Christoph Mallon [Thu, 17 May 2012 13:57:00 +0000 (15:57 +0200)]
Store the whole second argument expression of __builtin_va_start(), not just a variable_t.
Christoph Mallon [Thu, 17 May 2012 17:57:16 +0000 (19:57 +0200)]
Rename "expr" to "param" in parse_va_start().
Christoph Mallon [Thu, 17 May 2012 17:56:49 +0000 (19:56 +0200)]
First finish parsing, then do semantic checks in parse_va_start().
Matthias Braun [Fri, 18 May 2012 23:54:17 +0000 (01:54 +0200)]
preprocessor tests moved to testsuite
Matthias Braun [Fri, 18 May 2012 23:54:57 +0000 (01:54 +0200)]
preprocessor: rework headername parsing
Matthias Braun [Fri, 18 May 2012 21:37:11 +0000 (23:37 +0200)]
preprocessor: correctly implement "" includes
Matthias Braun [Fri, 18 May 2012 21:15:11 +0000 (23:15 +0200)]
preprocessor: implement -o in pptest
Matthias Braun [Fri, 18 May 2012 16:45:08 +0000 (18:45 +0200)]
set layouted earlier to break cycles
Otherwise the compiler can crash for recursive structs