Changeset 219791 in webkit


Ignore:
Timestamp:
Jul 23, 2017 2:01:28 PM (7 years ago)
Author:
Michael Catanzaro
Message:

Implement FALLTHROUGH attribute for C with GCC
https://bugs.webkit.org/show_bug.cgi?id=174555

Reviewed by Darin Adler.

My previous attempt to silence the JSC -Wimplicit-fallthrough warnings failed because they
are coming from a C file, and our FALLTHROUGH macro is only implemented for C++. So
implement it for C as well, using C attribute syntax.

Note this is only possible to do for GCC, because Clang only supports this attribute using
the C++ attribute syntax?.

  • wtf/Compiler.h:
Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r219763 r219791  
     12017-07-23  Michael Catanzaro  <mcatanzaro@igalia.com>
     2
     3        Implement FALLTHROUGH attribute for C with GCC
     4        https://bugs.webkit.org/show_bug.cgi?id=174555
     5
     6        Reviewed by Darin Adler.
     7
     8        My previous attempt to silence the JSC -Wimplicit-fallthrough warnings failed because they
     9        are coming from a C file, and our FALLTHROUGH macro is only implemented for C++. So
     10        implement it for C as well, using C attribute syntax.
     11 
     12        Note this is only possible to do for GCC, because Clang only supports this attribute using
     13        the [[C++ attribute syntax]].
     14
     15        * wtf/Compiler.h:
     16
    1172017-07-14  Filip Pizlo  <fpizlo@apple.com>
    218
  • trunk/Source/WTF/wtf/Compiler.h

    r219244 r219791  
    213213#endif
    214214
     215#elif !defined(FALLTHROUGH) && !defined(__cplusplus)
     216
     217#if COMPILER(GCC)
     218#if GCC_VERSION_AT_LEAST(7, 0, 0)
     219#define FALLTHROUGH __attribute__ ((fallthrough))
     220#endif
     221#endif
     222
    215223#endif // !defined(FALLTHROUGH) && defined(__cplusplus) && defined(__has_cpp_attribute)
    216224
Note: See TracChangeset for help on using the changeset viewer.