Chapel: Errors while building

Created on 16 Jan 2018  路  4Comments  路  Source: chapel-lang/chapel

I don't know if this is useful, please close if not. When building from a fresh pull, I get these messages:

clang++ -c -std=gnu++11  -MMD -MP -O3 -I. -I../include/darwin -I../include    -Wno-error -o ../../build/compiler/darwin/clang/llvm-none/parser/bison-chapel.o bison-chapel.cpp
clang++ -c -std=gnu++11  -MMD -MP -O3 -I. -I../include/darwin -I../include    -Wno-error -o ../../build/compiler/darwin/clang/llvm-none/parser/flex-chapel.o flex-chapel.cpp
flex-chapel.cpp:1015:2: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
        register yy_state_type yy_current_state;
        ^~~~~~~~~
flex-chapel.cpp:1016:2: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
        register char *yy_cp, *yy_bp;
        ^~~~~~~~~
flex-chapel.cpp:1016:2: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
        register char *yy_cp, *yy_bp;
        ^~~~~~~~~
flex-chapel.cpp:1017:2: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
        register int yy_act;
        ^~~~~~~~~
flex-chapel.cpp:1071:4: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
                        register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
                        ^~~~~~~~~
flex-chapel.cpp:2005:2: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
        register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
        ^~~~~~~~~
flex-chapel.cpp:2006:2: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
        register char *source = yyg->yytext_ptr;
        ^~~~~~~~~
flex-chapel.cpp:2007:2: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
        register int number_to_move, i;
        ^~~~~~~~~
flex-chapel.cpp:2007:2: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
        register int number_to_move, i;
        ^~~~~~~~~
flex-chapel.cpp:2139:2: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
        register yy_state_type yy_current_state;
        ^~~~~~~~~
flex-chapel.cpp:2140:2: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
        register char *yy_cp;
        ^~~~~~~~~
flex-chapel.cpp:2147:3: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
                register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
                ^~~~~~~~~
flex-chapel.cpp:2172:2: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
        register int yy_is_jam;
        ^~~~~~~~~
flex-chapel.cpp:2174:2: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
        register char *yy_cp = yyg->yy_c_buf_p;
        ^~~~~~~~~
flex-chapel.cpp:2176:2: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
        register YY_CHAR yy_c = 1;
        ^~~~~~~~~
15 warnings generated.
clang++ -c -std=gnu++11  -MMD -MP -O3 -I. -I../include/darwin -I../include    -o ../../build/compiler/darwin/clang/llvm-none/parser/countTokens.o countTokens.cpp
clang++ -c -std=gnu++11  -MMD -MP -O3 -I. -I../include/darwin -I../include    -o ../../build/compiler/darwin/clang/llvm-none/parser/parser.o parser.cpp
***** passes/ *****
BTR user issue

Most helpful comment

For clang++ we can add -Wno-invalid-noreturn, but I don't see an equivalent option for g++.

Looking a bit closer at it, the invalid-noreturn warning appears to be at least somewhat our fault. The newer flex version adds the noreturn attribute to yy_fatal_error(), which calls exit() on all paths, so the attribute looks correct.

However, we redefine exit() in chapel.lex as: #define exit(x) clean_exit(x). clean_exit() calls the real exit(), but doesn't have a noreturn attribute. So a real fix for the warning would be to add the noreturn attribute to clean_exit().

All 4 comments

These warnings are coming from a source file generated by the tool flex. Updating the version of flex used to generate this file to at least 2.6.0 and regenerating it cleans these warnings up by not using the register storage class specifier anymore.

Unfortunately version 2.6.4 (the version currently available in homebrew) gets one instance of a different warning:

flex-chapel.cpp:2715:1: warning: function declared 'noreturn' should not return [-Winvalid-noreturn]

Unfortunately version 2.6.4 (the version currently available in homebrew) gets one instance of a different warning

@daviditen: I suspect you know this already, but we have flag variables that are (only) applied to the flex/bison-generated files in the Makefiles already. Couldn't we add a -Wno-invalid-noreturn in order to work around the new warning if need be?

For clang++ we can add -Wno-invalid-noreturn, but I don't see an equivalent option for g++.

Looking a bit closer at it, the invalid-noreturn warning appears to be at least somewhat our fault. The newer flex version adds the noreturn attribute to yy_fatal_error(), which calls exit() on all paths, so the attribute looks correct.

However, we redefine exit() in chapel.lex as: #define exit(x) clean_exit(x). clean_exit() calls the real exit(), but doesn't have a noreturn attribute. So a real fix for the warning would be to add the noreturn attribute to clean_exit().

These warnings are now fixed on master. The parser directory builds with no warnings.

Was this page helpful?
0 / 5 - 0 ratings