Skip to content
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

ac_std_float has some compiler warnings with clang-9 #13

Open
lirp opened this issue Aug 27, 2020 · 0 comments
Open

ac_std_float has some compiler warnings with clang-9 #13

lirp opened this issue Aug 27, 2020 · 0 comments

Comments

@lirp
Copy link

lirp commented Aug 27, 2020

ac_std_float has some compiler warnings with clang-9.

For example, with -Wbitwise-conditional-parentheses and -Wunused-variable:
./ac_types/include/ac_std_float.h:429:23: error: unused variable 'rnd' [-Werror,-Wunused-variable]
static const bool rnd = QFX!=AC_TRN && QFX!=AC_TRN_ZERO;

...

./ac_types/include/ac_std_float.h:790:51: error: operator '?:' has lower precedence than '|'; '|' will be evaluated first [-Werror,-Wbitwise-conditional-parentheses]
int exp = ( (e1_lt_e2 & !op2_zero) | op1_zero ? op2_e_b : op1_e_b);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
./ac_types/include/ac_std_float.h:790:51: note: place parentheses around the '|' expression to silence this warning
int exp = ( (e1_lt_e2 & !op2_zero) | op1_zero ? op2_e_b : op1_e_b);
^
( )
./ac_types/include/ac_std_float.h:790:51: note: place parentheses around the '?:' expression to evaluate it first
int exp = ( (e1_lt_e2 & !op2_zero) | op1_zero ? op2_e_b : op1_e_b);

It would be really nice if this new header could be warnings-clean under clang, as disabling warnings transitively affects every translation unit that includes the header, and we've found these warnings to be particularly effective at keeping code bug-free.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant