Matthias Braun [Fri, 13 Jul 2012 21:09:08 +0000 (23:09 +0200)]
respect getcwd return value
this fixes a warning
Matthias Braun [Fri, 13 Jul 2012 12:16:49 +0000 (14:16 +0200)]
implement is_universal_char_valid_identifier_c99
Christoph Mallon [Mon, 9 Jul 2012 10:35:53 +0000 (12:35 +0200)]
Only classify several expressions as constant if no error is involved.
Christoph Mallon [Mon, 9 Jul 2012 09:55:23 +0000 (11:55 +0200)]
Add the option c11 to -std and add the C11 keywords.
- Use _Thread_local instead of __thread internally.
- Use _Alignof instead of __alignof__ internally.
Christoph Mallon [Mon, 9 Jul 2012 07:52:49 +0000 (09:52 +0200)]
Implement -idirafter.
Christoph Mallon [Mon, 2 Jul 2012 16:38:02 +0000 (18:38 +0200)]
Record and handle, whether a search path is a system path.
Matthias Braun [Thu, 5 Jul 2012 18:13:00 +0000 (20:13 +0200)]
better search paths handling; respect -I
Matthias Braun [Thu, 5 Jul 2012 16:33:02 +0000 (18:33 +0200)]
bugfix for external non-emitting API
Matthias Braun [Wed, 6 Jun 2012 17:52:19 +0000 (19:52 +0200)]
whitespace before tokens affects macro redef
Matthias Braun [Sun, 3 Jun 2012 14:01:38 +0000 (16:01 +0200)]
implement includefile macro expansion
Matthias Braun [Sat, 26 May 2012 07:28:19 +0000 (09:28 +0200)]
show additional space before macro expanded '#'
gcc/clang output an additional space before a (macro-expanded) '#' at
line begin. So we replicate this behaviour.
Matthias Braun [Fri, 25 May 2012 17:30:39 +0000 (19:30 +0200)]
preprocessor: implement stringify operation '#'
Christoph Mallon [Sun, 1 Jul 2012 07:28:33 +0000 (09:28 +0200)]
Simplify peek_expansion().
Matthias Braun [Mon, 18 Jun 2012 23:12:51 +0000 (01:12 +0200)]
preprocessor: output '3' flag for system headers
Christoph Mallon [Sun, 1 Jul 2012 06:40:29 +0000 (08:40 +0200)]
Implement #include_next.
Christoph Mallon [Mon, 2 Jul 2012 16:59:29 +0000 (18:59 +0200)]
Test skip_mode in parse_pragma_directive().
Christoph Mallon [Fri, 29 Jun 2012 18:05:53 +0000 (20:05 +0200)]
Properly test for a valid identifer after #define and #undef.
Christoph Mallon [Fri, 22 Jun 2012 20:39:26 +0000 (22:39 +0200)]
Reimplement input_error(), which got lost with the old lexer.
Christoph Mallon [Fri, 22 Jun 2012 09:29:19 +0000 (11:29 +0200)]
Implement #error.
Christoph Mallon [Fri, 6 Jul 2012 09:09:59 +0000 (11:09 +0200)]
Correct do_include().
Do not alter headername, which is needed unaltered later on.
Christoph Mallon [Fri, 6 Jul 2012 09:01:53 +0000 (11:01 +0200)]
Remove pointless local variable.
Christoph Mallon [Fri, 6 Jul 2012 08:59:05 +0000 (10:59 +0200)]
Remove redundante fclose(), which is handles by close_input() a few lines later.
Christoph Mallon [Fri, 6 Jul 2012 09:00:46 +0000 (11:00 +0200)]
Always reset unit->input in close_input().
Matthias Braun [Thu, 5 Jul 2012 16:19:27 +0000 (18:19 +0200)]
rework compilation loop, use our preproc for -E
also removed --lextest which was broken and not really usefull anymore
Matthias Braun [Thu, 5 Jul 2012 15:57:27 +0000 (17:57 +0200)]
make pp_token emit API public
Christoph Mallon [Thu, 5 Jul 2012 06:57:58 +0000 (08:57 +0200)]
Avoid endless loop when encountering EOF while parsing an initializer.
Christoph Mallon [Thu, 5 Jul 2012 06:33:55 +0000 (08:33 +0200)]
Plug a memory leak (and reduce code duplication) for string initializers with extra curly braces.
Christoph Mallon [Thu, 5 Jul 2012 06:33:29 +0000 (08:33 +0200)]
Show the right type when warning about excessive initializer elements.
Matthias Braun [Wed, 4 Jul 2012 12:45:30 +0000 (14:45 +0200)]
fix line-directive parser
It was happily eating tokens from the following lines as long as they
were numbers and strings.
Matthias Braun [Wed, 4 Jul 2012 09:11:18 +0000 (11:11 +0200)]
do NOT use #if for target platform decisions
(or we will end up like gcc where you have to compile each host/target
combination again, instead of having 1 compiler which can produce
everything)
Matthias Braun [Tue, 3 Jul 2012 10:47:20 +0000 (12:47 +0200)]
remove unnecessary ATOMIC_TYPE_INVALID
Matthias Braun [Tue, 3 Jul 2012 10:38:21 +0000 (12:38 +0200)]
slightly simplify wchar_t handling
Christoph Mallon [Tue, 3 Jul 2012 14:55:44 +0000 (16:55 +0200)]
Properly support -ansi.
Christoph Mallon [Tue, 3 Jul 2012 14:54:56 +0000 (16:54 +0200)]
Document -std=c90 in the manpage.
Sebastian Buchwald [Tue, 3 Jul 2012 14:05:51 +0000 (16:05 +0200)]
Added documentation for -std=c90.
Christoph Mallon [Tue, 3 Jul 2012 14:32:58 +0000 (16:32 +0200)]
Add -std=c90 as alias for -std=c89.
Christoph Mallon [Tue, 3 Jul 2012 14:29:53 +0000 (16:29 +0200)]
Factorise conversion from lang_standard_t to a string into a function.
Sebastian Buchwald [Tue, 3 Jul 2012 13:54:04 +0000 (15:54 +0200)]
Fixed warning for -std=iso9899:199409.
Sebastian Buchwald [Tue, 3 Jul 2012 13:49:37 +0000 (15:49 +0200)]
Renamed enum entry.
Christoph Mallon [Tue, 3 Jul 2012 11:15:44 +0000 (13:15 +0200)]
Use obstack_copy() instead of obstack_alloc() + memcpy().
Christoph Mallon [Tue, 3 Jul 2012 10:52:24 +0000 (12:52 +0200)]
Remove the token registration macro TS.
T is sufficient.
Christoph Mallon [Tue, 3 Jul 2012 10:43:17 +0000 (12:43 +0200)]
Concatenate T_ earlier to the token names.
This way we get rid of many #undef, which were necessary, because several token names are macros in system headers.
Christoph Mallon [Tue, 3 Jul 2012 10:26:07 +0000 (12:26 +0200)]
Remove _ANSI.
It should be just another word for _C89, but wasn't.
Matthias Braun [Thu, 21 Jun 2012 09:10:21 +0000 (11:10 +0200)]
fix warning
Christoph Mallon [Wed, 20 Jun 2012 19:43:35 +0000 (21:43 +0200)]
Replace the old lexer by the new preprocessor.
Matthias Braun [Tue, 19 Jun 2012 00:24:06 +0000 (02:24 +0200)]
copy dollar in identifier feature from lexer
Matthias Braun [Tue, 19 Jun 2012 00:08:09 +0000 (02:08 +0200)]
copy universal character parsing from lexer
Matthias Braun [Mon, 18 Jun 2012 23:13:15 +0000 (01:13 +0200)]
copy line and pragma directive parsers from lexer
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.