buggperf - Bugs: bug #53029, Provide option to configure...

 
 

bug #53029: Provide option to configure `/*FALLTHROUGH*/`

Submitter:  Nico Weber <thakis>
Submitted:  Wed 31 Jan 2018 01:45:59 PM UTC
   
 
Category:  Generated code Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  haible
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 09 Sep 2018 01:33:58 PM UTC, comment #4: 

That should do the trick. Thanks!

Anonymous
Sat 08 Sep 2018 11:17:29 PM UTC, comment #3: 


> Imho the original suggestion is better


No, the idea of an additional command-line option fails to contain the complexity, as explained in https://lists.gnu.org/archive/html/bug-gperf/2018-07/msg00006.html

> We don't build with -std=c++17 yet, and clang doesn't support attribute ((fallthrough)), and it also doesn't have GNUC > 7.


Ah, so we need a fix for the time until everyone uses C++17. Done:
http://git.savannah.gnu.org/gitweb/?p=gperf.git;a=commitdiff;h=50840436d5df8692d2d730be759d2a007948a044

Bruno Haible <haible>
Group administrator
Sat 08 Sep 2018 08:51:54 PM UTC, comment #2: 

Thanks, but http://git.savannah.gnu.org/gitweb/?p=gperf.git;a=commitdiff;h=0d37a8763d9a5169ee2cb71a0281f859ca159b87 isn't a good fix for us. We don't build with -std=c++17 yet, and clang doesn't support _attribute_ ((_fallthrough_)), and it also doesn't have _GNUC_ > 7. Imho the original suggestion is better, but if you want to follow the approach you've followed you need something like

#elif defined(_clang_)
#define FALLTHROUGH [[clang::fallthrough]]

too.

Anonymous
Sat 08 Sep 2018 02:49:42 PM UTC, comment #1: 

Thanks for the suggestion. It's even possible to avoid the implicit-fallthrough warnings without a command-line option or inline declaration.

Implemented through this patch:
http://git.savannah.gnu.org/gitweb/?p=gperf.git;a=commitdiff;h=0d37a8763d9a5169ee2cb71a0281f859ca159b87

Bruno Haible <haible>
Group administrator
Wed 31 Jan 2018 01:45:59 PM UTC, original submission:  

Both gcc and clang now offer a -Wunintended-fallthrough warning option, which requires explicitly putting in a fallthrough statement. Both compilers have language extensions for this (clang has `[[clang::fallthrough]]`, gcc has `[[gnu::fallthrough]]`, `__attribute__((fallthrough))`, and it optionally also accepts certain comments.) C++17 adds language support for fallthrough. In practice, this means projects currently use a macro, e.g. `FALLTHROUGH`, for this.

gperf currently marks fallthroughs with `/*FALLTHROUGH*/`. It'd be useful if there was an option to customize this, e.g.

  --fallthrough-spelling=foo

and foo defaults to `/*FALLTHROUGH*/`, but projects could then pick their own macro name, or if they target C++17, they could set foo to `[[fallthrough]];`.

Nico Weber <thakis>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #44620:  gperf-fallthrough.patch added by None (17KiB - application/octet-stream - Attached patch introduces the flag --fallthrough=WHATEVER. It's essentially what OP asked for without the "-spelling" part.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by haible (Posted a comment)
  • -email is unavailable- added by thakis (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-09-08 haible StatusNone Fixed
        Assigned toNone haible
        Open/ClosedOpen Closed
    2018-07-25 None Attached File- Added gperf-fallthrough.patch, #44620

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code