bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

glr.c: work around ICC limitations


From: Akim Demaille
Subject: glr.c: work around ICC limitations
Date: Tue, 18 Sep 2018 20:02:59 +0200

Found by the CI.

commit a60a9e30717e94c293ede74b2666325558d158a1
Author: Akim Demaille <address@hidden>
Date:   Tue Sep 18 06:12:36 2018 +0200

    glr.c: work around ICC limitations
    
    The CI is littered with
    
        #                             -*- compilation -*-
        423. regression.at:907: testing Dancer %glr-parser ...
        ./regression.at:907: bison -fno-caret -o dancer.c dancer.y
        ./regression.at:907: $BISON_C_WORKS
        stderr:
        stdout:
        ./regression.at:907: $CC $CFLAGS $CPPFLAGS  $LDFLAGS -o dancer dancer.c 
$LIBS
        stderr:
        icc: command line warning #10006: ignoring unknown option '-Wcast-align'
        icc: command line warning #10006: ignoring unknown option 
'-fparse-all-comments'
        icc: command line warning #10006: ignoring unknown option 
'-Wdocumentation'
        icc: command line warning #10006: ignoring unknown option 
'-Wnull-dereference'
        icc: command line warning #10006: ignoring unknown option 
'-Wbad-function-cast'
        icc: command line warning #10006: ignoring unknown option 
'-fno-color-diagnostics'
        icc: command line warning #10006: ignoring unknown option 
'-Wno-keyword-macro'
        dancer.c(755): error #1628: function declared with "noreturn" does 
return
          }
          ^
    
        dancer.c(761): error #1628: function declared with "noreturn" does 
return
          }
          ^
    
        compilation aborted for dancer.c (code 2)
    
    ICC sees that `longjmp(buf, 1);` does not return, it sees that
    `abort();` does not either, but fails to see it for
    `longjmp(buf, 1); abort();`
    
    * data/glr.c (YYLONGJMP): Be even clearer on the fact this does not
    return.

diff --git a/data/glr.c b/data/glr.c
index 8d93b148..386dff0f 100644
--- a/data/glr.c
+++ b/data/glr.c
@@ -305,8 +305,12 @@ b4_percent_code_get[]dnl
 # include <setjmp.h>
 # define YYJMP_BUF jmp_buf
 # define YYSETJMP(Env) setjmp (Env)
-/* Pacify clang.  */
-# define YYLONGJMP(Env, Val) (longjmp (Env, Val), YYASSERT (0))
+/* Pacify Clang and ICC.  */
+# define YYLONGJMP(Env, Val)                    \
+ do {                                           \
+   longjmp (Env, Val);                          \
+   YYASSERT (0);                                \
+ } while (yyfalse)
 #endif
 
 ]b4_attribute_define[




reply via email to

[Prev in Thread] Current Thread [Next in Thread]