Skip to content

C front-end: labelled declarations are only supported by Visual Studio #5931

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 13, 2022

Conversation

tautschnig
Copy link
Collaborator

@tautschnig tautschnig commented Mar 15, 2021

In order to support GCC's label attributes even when the semicolon is
omitted, distinguish GCC and Visual Studio modes when parsing labelled
statements. See
https://github.com/gcc-mirror/gcc/blob/master/gcc/c/c-parser.cc#L6070 for
GCC's limitation, which we now mimic. (We already supported attributes
followed by a semicolon, which GCC's documentation mandates, but the
Linux kernel doesn't always follow this rule.) Fixed regression tests
that had declarations immediately following a label.

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • White-space or formatting changes outside the feature-related changed lines are in commits of their own.

@codecov
Copy link

codecov bot commented Mar 17, 2021

Codecov Report

Base: 78.39% // Head: 78.40% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (37b4773) compared to base (b03d870).
Patch coverage: 64.60% of modified lines in pull request are covered.

❗ Current head 37b4773 differs from pull request most recent head a5f789a. Consider uploading reports for the commit a5f789a to get more accurate results

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #5931   +/-   ##
========================================
  Coverage    78.39%   78.40%           
========================================
  Files         1655     1655           
  Lines       190281   190302   +21     
========================================
+ Hits        149172   149200   +28     
+ Misses       41109    41102    -7     
Impacted Files Coverage Δ
src/ansi-c/c_typecheck_base.cpp 82.73% <33.33%> (-0.57%) ⬇️
src/cpp/parse.cpp 69.09% <48.64%> (+0.28%) ⬆️
src/ansi-c/parser.y 80.99% <100.00%> (+0.09%) ⬆️
src/ansi-c/scanner.l 63.46% <100.00%> (+0.06%) ⬆️
...c/solvers/smt2_incremental/convert_expr_to_smt.cpp 83.48% <100.00%> (ø)
src/util/lower_byte_operators.cpp 92.76% <100.00%> (+0.14%) ⬆️
...t/solvers/smt2_incremental/convert_expr_to_smt.cpp 99.60% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@peterschrammel
Copy link
Member

@tautschnig
Copy link
Collaborator Author

The link https://github.com/gcc-mirror/gcc/blob/master/gcc/c/c-parser.c#L5553 doesn't work.

I have updated the link in both the commit message and the PR description.

In order to support GCC's label attributes even when the semicolon is
omitted, distinguish GCC and Visual Studio modes when parsing labelled
statements. See
https://github.com/gcc-mirror/gcc/blob/master/gcc/c/c-parser.cc#L6070
for GCC's limitation, which we now mimic. (We already supported
attributes followed by a semicolon, which GCC's documentation mandates,
but the Linux kernel doesn't always follow this rule.) Fixed regression
tests that had declarations immediately following a label.
Also added braces where an if condition spans multiple lines, and
replace one case of if(...) return true; return false; by return (...);
@peterschrammel peterschrammel removed their assignment Dec 13, 2022
@tautschnig tautschnig merged commit c1d8eb2 into diffblue:develop Dec 13, 2022
@tautschnig tautschnig deleted the labelled-decls branch December 13, 2022 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants