warning in hal_pwm_lld?

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: RoccoMarco, barthess

rew
Posts: 380
Joined: Sat Jul 19, 2014 12:59 pm
Has thanked: 2 times
Been thanked: 13 times

warning in hal_pwm_lld?

Postby rew » Sun May 31, 2020 11:12 am

There are several sections that are similar to this:

Code: Select all

 switch (pwmp->config->channels[2].mode & PWM_OUTPUT_MASK) {
  case PWM_OUTPUT_ACTIVE_LOW:
    ccer |= STM32_TIM_CCER_CC3P;
    // fall through
  case PWM_OUTPUT_ACTIVE_HIGH:
    ccer |= STM32_TIM_CCER_CC3E;
  default:
    ;
    }
My new compiler gives a warning about the fallthrough. The idea is that you add the comment I've added here already if this is intentional. Or you can fix the bug if it was unintentional.

I started writing this, when I wasn't sure that this wasn't a bug. I've changed my mind, the fall through is intentional, so we need a bunch of those "fall through" comments.

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: warning in hal_pwm_lld?

Postby Giovanni » Sun May 31, 2020 11:40 am

It is intentional.

Which compiler?

Giovanni

steved
Posts: 825
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

Re: warning in hal_pwm_lld?

Postby steved » Sun May 31, 2020 12:34 pm

I saw it in mingw32 last October (viewtopic.php?f=35&t=5234&p=36331) which I think is GCC.

Looks like its been in GCC7 for a while:
https://stackoverflow.com/questions/451 ... clear-them
https://stackoverflow.com/questions/495 ... ons-of-gcc

rew
Posts: 380
Joined: Sat Jul 19, 2014 12:59 pm
Has thanked: 2 times
Been thanked: 13 times

Re: warning in hal_pwm_lld?

Postby rew » Sun May 31, 2020 12:48 pm

Yup gcc7 here too.

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: warning in hal_pwm_lld?

Postby Giovanni » Sun May 31, 2020 1:15 pm

The driver already includes those comments, since 2017.

Giovanni

steved
Posts: 825
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

Re: warning in hal_pwm_lld?

Postby steved » Sun May 31, 2020 4:18 pm

IIRC the acceptable format for the 'FALLTHROUGH' comment varies across compilers - at one point I have a recollection of checking compiler version first.
Most recently I've been using /* FALLTHROUGH */ which hasn't produced any errors, but not sure whether the standard Chibi compile options include checking for fallthrough

mikeprotts
Posts: 166
Joined: Wed Jan 09, 2019 12:37 pm
Has thanked: 19 times
Been thanked: 31 times

Re: warning in hal_pwm_lld?

Postby mikeprotts » Sun May 31, 2020 5:02 pm


User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: warning in hal_pwm_lld?

Postby Giovanni » Sun May 31, 2020 5:07 pm

Hi,

I saw that, but the code is supposed to be compiled with not just GCC.

The comment is fine with all common ARM compilers anyway.

Giovanni

rew
Posts: 380
Joined: Sat Jul 19, 2014 12:59 pm
Has thanked: 2 times
Been thanked: 13 times

Re: warning in hal_pwm_lld?

Postby rew » Wed Jun 03, 2020 9:27 am

The comment in my posting is AFTER checking the GCC documentation for what should be used to tag an intentional fall through.

OK. I just checked.... The current code has a different spelling of my addition, so it is not my addition. I thought I had updated chibios Friday before reporting . but now with the tuesday pull-update I have the comments. OK. Good. Fixed!

According to GIT you added those comments in 2017. Now I really don't understand anymore why I saw the issue. Oh well.


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 48 guests