aboutsummaryrefslogtreecommitdiffstats
path: root/cparser
Commit message (Collapse)AuthorAgeFilesLines
* Enum is compatible to its integer type.Bernhard Schommer2015-12-171-0/+3
| | | | | | The C standard specifies that an enum type should be compatible to some integer type (ISO/IEC 9899:TC3 §6.7.2.2p4). Fix 16692
* More gcc/newlib compatibility code.Bernhard Schommer2015-12-111-1/+8
| | | | | | | | | | Some newlib headers use the __extension__ keyword which suppresses warnings for gcc extensions in strict mode. CompCert now ignores this keyword for the gnu backends. Also it seems that stddef of the gcc defines wint_t even though it should not. However some libs rely on this. So wint_t is now defined in CompCert's stddef header. Bug 17613.
* Revise and simplify the -fstruct-return and -fstruct-passing options.Xavier Leroy2015-12-081-2/+2
| | | | | | - Rename '-fstruct-return' into '-fstruct-passing', because this emulation affects both function result passing and function argument passing. Keep '-fstruct-return' as a deprecated synonymous for '-fstruct-passing' - Remove the ability to change the ABI for struct passing via the '-fstruct-passing=<abi>' and '-fstruct-return=<abi>' command-line flags. This was more confusing than useful. - Produce an error if a struct/union is passed as function argument and '-fstruct-passing' is not set. This used to be supported, using CompCert's default ABI for passing struct arguments. However, this default ABI does not match any of the standard ABIs of our target platforms, so it is better to reject than to silently produce ABI-incompatible code.
* Fixed regression introduce by merge of PR#69.Bernhard Schommer2015-12-031-4/+1
| | | | | | | Since the identifier of a function definition and of its declaration are equal we only should remove functions if the function iteself is removed. Bug 17724.
* Open files in binary mode.Bernhard Schommer2015-11-301-1/+1
| | | | | | On windows opening files in text mode can result in errors due to non-windows compatible input. Thus open files only in binary mode. Bug 17664
* For uniformity with other messages, added an "Ill-formed expression.".François Pottier2015-11-241-0/+1
|
* Use 1-based column numbers instead of 0-based.François Pottier2015-11-241-2/+2
| | | | This seems to agree with clang and with the emacs C mode.
* Update of the auto-generated comments.François Pottier2015-11-241-610/+611
|
* A simplification in the grammar, leading to fewer states in the automatonFrançois Pottier2015-11-242-19/+4
| | | | and merging two error states into one. There should be no observable change.
* Fix a typo in a syntax error message.François Pottier2015-11-231-1/+1
|
* Issue #71: incorrect initialization of wchar_t arrays from wide string literalXavier Leroy2015-11-131-6/+6
| | | | Regression test added in regression/initializers.c
* Merge pull request #69 from jhjourdan/parser_fixBernhard Schommer2015-11-129-2351/+1836
|\ | | | | Parser : duplicate identifier tokens, fix K&R definition parsing
| * Typo, coherence in error messagesJacques-Henri Jourdan2015-11-072-7/+8
| |
| * Integrate a few comments of F. Pottier into the pre_parser and ↵Jacques-Henri Jourdan2015-11-073-141/+139
| | | | | | | | handcrafted.messages
| * Updating deLexer to PRE_NAME tokensJacques-Henri Jourdan2015-11-071-0/+3
| |
| * Merge remote-tracking branch 'origin/master' into parser_fixJacques-Henri Jourdan2015-11-073-5/+23
| |\
| * \ Merge remote-tracking branch 'origin/master' into parser_fixJacques-Henri Jourdan2015-11-0449-328/+5967
| |\ \
| * | | Better handling of old-style K&R function declarations:Jacques-Henri Jourdan2015-11-015-258/+276
| | | | | | | | | | | | | | | | | | | | | | | | - Added a Cabs.PROTO_OLD constructor to Cabs.decl_type - Refactored the Parser.vy and pre_parser.mly grammars - Rewritten the conversion of old function definitions to new-style
| * | | other, simpler fix: the lexer emits 2 tokens for each identifierJacques-Henri Jourdan2015-10-083-257/+181
| | | |
* | | | Merge pull request #68 from fpottier/cutBernhard Schommer2015-11-122-2/+2
|\ \ \ \ | | | | | | | | | | Fix in cparser/GNUmakefile.
| * | | | Change one line in [Lexer.mll] to obey API change in Menhir 20151110.François Pottier2015-11-101-1/+1
| | | | | | | | | | | | | | | | | | | | Update configure to require Menhir 20151110.
| * | | | Fix in cparser/GNUmakefile.François Pottier2015-11-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove "&" which was a typo and did not make sense. Use "command -v" instead of "which" (more efficient). Use "=" instead of ":=" (more efficient).
* | | | | Handle large static initializers for global arraysXavier Leroy2015-11-095-5/+5
| |_|_|/ |/| | | | | | | | | | | Use tail-recursive operations to implement transformations on initializers for global arrays. This way, very large static initializers no longer cause stack overflows at compile-time.
* | | | Remove debug stmts during grouping of switch.Bernhard Schommer2015-11-062-4/+14
|/ / / | | | | | | | | | | | | | | | | | | Debug statements introduced during the translation result in warnings when they are introduced at the head of the switch. Since they are not used and the warning is not necessary we can remove them before. Fix 17580.
* | / When printing a fragment of source text as part of an error message, ↵François Pottier2015-11-031-1/+9
| |/ |/| | | | | | | | | | | compress multiple whitespace characters into just one space character. This is done before the call to [sanitize], which replaces special characters with a dot. This produces more a readable result when the error spans multiple lines.
* | Set [ErrorReports.debug] to [false].François Pottier2015-10-281-1/+1
| | | | | | | | | | | | When [debug] is [false], there are a few places where we silently ignore an error. This should not make any difference if everything works as planned.
* | Fixed some comments.François Pottier2015-10-281-16/+16
| |
* | Merge pull request #61 from fpottier/cleanBernhard Schommer2015-10-261-5/+1
|\ \ | | | | | | Fixed one error message and removed two comments.
| * | Fixed one error message and removed two comments.François Pottier2015-10-261-5/+1
| | |
* | | Also redirect the output of stderr.Bernhard Schommer2015-10-261-2/+1
|/ / | | | | | | Bug 17481.
* | Merge remote branch 'upstream/master' into cleanFrançois Pottier2015-10-2327-160/+206
|\ \ | | | | | | | | | | | | Conflicts: Makefile.extr
| * \ Merge branch 'clean' of https://github.com/fpottier/CompCert into fpottier-cleanBernhard Schommer2015-10-201-84/+104
| |\ \ | | | | | | | | | | | | | | | | Conflicts: Makefile.extr
| * | | bug 17392: remove trailing whitespace in source filesMichael Schmidt2015-10-149-40/+40
| | | |
| * | | bug 17392: remove trailing whitespace in source filesMichael Schmidt2015-10-1418-122/+122
| | | |
| * | | Move strip functions to Cutil.Bernhard Schommer2015-10-122-0/+46
| | |/ | |/| | | | | | | | | | | | | Since the strip functions might be useful in other context and is more general then the debug information. Bug 17392.
* | | Added copyright banners to the new files.François Pottier2015-10-237-0/+82
| | |
* | | Added a few cleanup commands in [make clean].François Pottier2015-10-231-1/+1
| | |
* | | Added some handwritten .c files in tests/handwritten/.François Pottier2015-10-2311-0/+59
| | |
* | | Install the new system for reporting syntax errors.François Pottier2015-10-237-6/+5777
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This requires the development version of Menhir, to be released soon. In summary: handcrafted.messages is new. It contains a mapping of erroneous sentences to error messages, together with a lot of comments. Makefile.extr is new. It contains a rule to generate cparser/pre_parser_messages.ml based on this mapping. cparser/ErrorReports.{ml,mli} are new. They construct syntax error messages, based on the compiled mapping. cparser/Lexer.mll is modified. The last two tokens that have been read are stored in a buffer. ErrorReports is called to construct a syntax error message. cparser/GNUmakefile is new. It offers several commands for working on the pre-parser. cparser/deLexer.ml is new. It is a script (it is not linked into CompCert). It translates the symbolic name of a token to an example of this token in concrete C syntax. It is used by [make -C cparser concrete] to produce the .c files in tests/generated/. cparser/tests/generated/Makefile is new. It runs ccomp, clang and gcc on each of the generated C files, so as to allow a comparison of the error messages.
* | | Lexer update: use Menhir's incremental API instead of Menhir's traditional API.François Pottier2015-10-231-3/+16
| | | | | | | | | | | | | | | This means that CompCert must now be compiled in --table mode. At this point, the error message for a syntax error is still just "syntax error".
* | | Lexer cleanup: isolate [lexer_wraper] and rename it to [lexer].François Pottier2015-10-231-6/+10
| | |
* | | Lexer cleanup: isolate the entry point into the lexer.François Pottier2015-10-231-6/+10
| | |
* | | Added an %on_error_reduce declaration.François Pottier2015-10-231-0/+42
| | | | | | | | | | | | | | | This affects in which states errors are detected, but does not change the language that is accepted.
* | | Changed [asm_flags] to a left-recursive list.François Pottier2015-10-231-1/+1
| | | | | | | | | | | | This allows us to give a better error message in one state.
* | | Removed the two uses of $syntaxerror in a semantic action.François Pottier2015-10-231-2/+7
| | | | | | | | | | | | | | | | | | | | | For the first one, this is fine; the error is caught by a type check later on. For the second one, it is temporary. More thought is needed about the syntax of K&R functions anyway, as Jacques-Henri and I discovered that it is currently broken (it mis-interprets some function definitions).
* | | Inlined [constant_expression] to save one state.François Pottier2015-10-231-1/+1
| | |
* | | Reformulated [specifier_qualifier_list_no_typedef_name] as a left-recursive ↵François Pottier2015-10-231-4/+4
| | | | | | | | | | | | | | | | | | list. This saves 7 states and 4 error states.
* | | Redefined [pointer] as a left-recursive list.François Pottier2015-10-231-7/+24
| | | | | | | | | | | | | | | This creates more states and does not change the number of error states. It should make it easier to give a good error message in at least 2 states.
* | | Replaced [declaration_specifiers_no_typedef_name] with ↵François Pottier2015-10-231-7/+3
| | | | | | | | | | | | | | | | | | | | | [declaration_specifier_no_typedef_name*]. This replaces a right-recursive list with a left-recursive list. This saves 2 states and 6 error states.
* | | Factorized [declaration_specifier_no_typedef_name].François Pottier2015-10-231-5/+9
| | | | | | | | | | | | This results in slightly fewer states.