Opened 8 years ago

Closed 8 years ago

#6275 closed enhancement (fixed)

Add a CPL_FALLTHROUGH macro

Reported by: Kurt Schwehr Owned by: Kurt Schwehr
Priority: normal Milestone:
Component: default Version: svn-trunk
Severity: normal Keywords:
Cc:

Description

For switch statements that have fall throughs, different compilers have their own way. e.g.

http://clang.llvm.org/docs/AttributeReference.html#fallthrough-clang-fallthrough

[[clang::fallthrough]];

Change History (4)

comment:1 by Kurt Schwehr, 8 years ago

r32866 in trunk

comment:2 by Kurt Schwehr, 8 years ago

Adding cpl_port.h to degrib18/degrib/metaprint.cpp causes

 warning: ‘sprintf’ is deprecated (declared at /home/travis/build/rouault/gdal_coverage/gdal/port/cpl_port.h:815

Hopefully fixed by r32867. I'm not sure that DONT_DEPRECATE_SPRINTF is the best solution, so even if it works, feel free to replace it with something better.

comment:3 by Even Rouault, 8 years ago

Milestone: 2.1.0

Unmilestoning

comment:4 by Even Rouault, 8 years ago

Resolution: fixed
Status: newclosed

In 35053:

Enable -Wimplicit-fallthrough and CPL_FALLTHROUGH for clang >= 3.7 and C++11, and add CPL_FALLTHROUGH when needed (fixes #6275)

Note: See TracTickets for help on using tickets.