2018-09-22 09:10 BST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002536LibCSSLibCSSpublic2018-04-21 09:24
ReporterAlastair Hughes 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Platformx86_64OSCustom linuxOS Version
Summary0002536: Build failure with GCC 7.1 due to implicit-fallthrough
DescriptionBuilding with GCC 7.1 fails due to the newly-added implicit-fallthrough feature. Some case statements in libcss's parser have a "Fall through" comment but are inside an additional set of braces, which prevents GCC's comment detection working and triggers a warning, which causes the build to fail. An example of this is seen at http://git.netsurf-browser.org/libcss.git/tree/src/parse/parse.c#n2094.

https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html describes the new behavior.

I have attached a patch which fixes this issue by removing the braces.
Steps To ReproduceAttempt to build libcss using GCC 7.1
TagsNo tags attached.
Fixed in CI build #
Reported in CI build #
Attached Files
  • patch file icon 0001-Remove-extra-braces-to-fix-build-with-gcc-7.patch (1,743 bytes) 2017-05-08 04:37 -
    From f80a0e7bc0095a4f87c59422c13904fb6f3ab14a Mon Sep 17 00:00:00 2001
    From: Alastair Hughes <hobbitalastair@gmail.com>
    Date: Mon, 8 May 2017 07:49:17 +1200
    Subject: [PATCH] Remove extra braces to fix build with gcc 7
    
    GCC 7.1 warns on "implicit fallthrough" in case statements.
    To avoid false positives it will attempt to match comments directly
    before the fall through in question, and if any match some form of "fall
    through" the fall through is ignored.
    For this particular instance extra braces prevent the comment being
    recognized, as the following line is not a label or a new case; remove
    the excess braces to let GCC recognize the comments.
    
    Signed-off-by: Alastair Hughes <hobbitalastair@gmail.com>
    ---
     src/parse/parse.c | 4 ----
     1 file changed, 4 deletions(-)
    
    diff --git a/src/parse/parse.c b/src/parse/parse.c
    index b65b0f5..7084a9e 100644
    --- a/src/parse/parse.c
    +++ b/src/parse/parse.c
    @@ -2091,7 +2091,6 @@ css_error parseMalformedDeclaration(css_parser *parser)
     
     	switch (state->substate) {
     	case Initial:
    -	{
     		/* Clear stack of open items */
     		while (parserutils_stack_pop(parser->open_items, NULL) == 
     				PARSERUTILS_OK)
    @@ -2099,7 +2098,6 @@ css_error parseMalformedDeclaration(css_parser *parser)
     
     		state->substate = Go;
     		/* Fall through */
    -	}
     	case Go:
     		while (1) {
     			char want;
    @@ -2289,7 +2287,6 @@ css_error parseMalformedAtRule(css_parser *parser)
     
     	switch (state->substate) {
     	case Initial:
    -	{
     		/* Clear stack of open items */
     		while (parserutils_stack_pop(parser->open_items, NULL) == 
     				PARSERUTILS_OK)
    @@ -2297,7 +2294,6 @@ css_error parseMalformedAtRule(css_parser *parser)
     
     		state->substate = Go;
     		/* Fall through */
    -	}
     	case Go:
     		while (1) {
     			char want;
    -- 
    2.12.2
    
    

-Relationships
+Relationships

-Notes
There are no notes attached to this issue.
+Notes

-Issue History
Date Modified Username Field Change
2017-05-08 04:37 Alastair Hughes New Issue
2017-05-08 04:37 Alastair Hughes File Added: 0001-Remove-extra-braces-to-fix-build-with-gcc-7.patch
2018-04-21 09:24 Michael Drake Status new => resolved
2018-04-21 09:24 Michael Drake Resolution open => fixed
+Issue History