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

Compiler warning with gcc 7.2.0 #826

Closed
anatol opened this issue Sep 28, 2017 · 6 comments
Closed

Compiler warning with gcc 7.2.0 #826

anatol opened this issue Sep 28, 2017 · 6 comments

Comments

@anatol
Copy link
Contributor

anatol commented Sep 28, 2017

Recent gcc started producing following warnings:

../common/timer_common_all.c:575:5: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
../common/timer_common_all.c: In function 'timer_enable_compare_control_update_on_trigger':
../common/timer_common_all.c:675:5: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
 #if ADVANCED_TIMERS
     ^~~~~~~~~~~~~~~
../common/timer_common_all.c:675:5: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
../common/timer_common_all.c: In function 'timer_disable_compare_control_update_on_trigger':
../common/timer_common_all.c:700:5: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
 #if ADVANCED_TIMERS
     ^~~~~~~~~~~~~~~
../common/timer_common_all.c:700:5: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
../common/timer_common_all.c: In function 'timer_enable_preload_complementry_enable_bits':
../common/timer_common_all.c:724:5: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
 #if ADVANCED_TIMERS
     ^~~~~~~~~~~~~~~
@karlp
Copy link
Member

karlp commented Sep 28, 2017

do they suggest a replacement? Because that seems pretty plain usage to me.

karlp added a commit to karlp/libopencm3 that referenced this issue Sep 28, 2017
gcc7.2 complained about the old syntax.  So, be more verbose.

Fixes: libopencm3#826
@karlp
Copy link
Member

karlp commented Sep 28, 2017

Can you try this out please? #827

@anatol
Copy link
Contributor Author

anatol commented Oct 6, 2017

Thanks a lot. This warning has gone. BTW that are few more warnings that you might want to look at:

../can.c: In function 'can_transmit':
../can.c:408:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
   tdhxr.data8[3] = data[7];
   ~~~~~~~~~~~~~~~^~~~~~~~~
../can.c:410:2: note: here
  case 7:
  ^~~~
../can.c:411:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
   tdhxr.data8[2] = data[6];
   ~~~~~~~~~~~~~~~^~~~~~~~~
../can.c:413:2: note: here
  case 6:
  ^~~~
../can.c:414:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
   tdhxr.data8[1] = data[5];
   ~~~~~~~~~~~~~~~^~~~~~~~~
../can.c:416:2: note: here
  case 5:
  ^~~~
../can.c:417:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
   tdhxr.data8[0] = data[4];
   ~~~~~~~~~~~~~~~^~~~~~~~~
../can.c:419:2: note: here
  case 4:
  ^~~~
../can.c:420:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
   tdlxr.data8[3] = data[3];
   ~~~~~~~~~~~~~~~^~~~~~~~~
../can.c:422:2: note: here
  case 3:
  ^~~~
../can.c:423:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
   tdlxr.data8[2] = data[2];
   ~~~~~~~~~~~~~~~^~~~~~~~~
../can.c:425:2: note: here
  case 2:
  ^~~~
../can.c:426:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
   tdlxr.data8[1] = data[1];
   ~~~~~~~~~~~~~~~^~~~~~~~~
../can.c:428:2: note: here
  case 1:
  ^~~~

@karlp
Copy link
Member

karlp commented Oct 6, 2017

out of scope of this ticket please. IF you want to work on them file separate tickets

@karlp
Copy link
Member

karlp commented Oct 6, 2017

(further, did you actually look at the code? it's very explicit, it just didn't use gcc's magical syntax to tell it the right way)

@karlp karlp closed this as completed in af7b219 Oct 6, 2017
@anatol
Copy link
Contributor Author

anatol commented Oct 10, 2017

Thank you Karl for fixing it. Now the build is clean of warnings.

BOJIT pushed a commit to BOJIT/PlatformIO-libopencm3 that referenced this issue Jan 30, 2021
gcc7.2 complained about the old syntax.  So, be more verbose.

Fixes: libopencm3#826
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

2 participants