xref: /freebsd/contrib/expat/lib/fallthrough.h (revision 207d96dabfec14d7b3699747abb539ab3c1118ab)
1c82aeee8SPhilip Paeps /*
2c82aeee8SPhilip Paeps                             __  __            _
3c82aeee8SPhilip Paeps                          ___\ \/ /_ __   __ _| |_
4c82aeee8SPhilip Paeps                         / _ \\  /| '_ \ / _` | __|
5c82aeee8SPhilip Paeps                        |  __//  \| |_) | (_| | |_
6c82aeee8SPhilip Paeps                         \___/_/\_\ .__/ \__,_|\__|
7c82aeee8SPhilip Paeps                                  |_| XML parser
8c82aeee8SPhilip Paeps 
9c82aeee8SPhilip Paeps    Copyright (c) 2026 Nick Begg <nick@stunttruck.net>
10c82aeee8SPhilip Paeps    Licensed under the MIT license:
11c82aeee8SPhilip Paeps 
12c82aeee8SPhilip Paeps    Permission is  hereby granted,  free of charge,  to any  person obtaining
13c82aeee8SPhilip Paeps    a  copy  of  this  software   and  associated  documentation  files  (the
14c82aeee8SPhilip Paeps    "Software"),  to  deal in  the  Software  without restriction,  including
15c82aeee8SPhilip Paeps    without  limitation the  rights  to use,  copy,  modify, merge,  publish,
16c82aeee8SPhilip Paeps    distribute, sublicense, and/or sell copies of the Software, and to permit
17c82aeee8SPhilip Paeps    persons  to whom  the Software  is  furnished to  do so,  subject to  the
18c82aeee8SPhilip Paeps    following conditions:
19c82aeee8SPhilip Paeps 
20c82aeee8SPhilip Paeps    The above copyright  notice and this permission notice  shall be included
21c82aeee8SPhilip Paeps    in all copies or substantial portions of the Software.
22c82aeee8SPhilip Paeps 
23c82aeee8SPhilip Paeps    THE  SOFTWARE  IS  PROVIDED  "AS  IS",  WITHOUT  WARRANTY  OF  ANY  KIND,
24c82aeee8SPhilip Paeps    EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF
25c82aeee8SPhilip Paeps    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
26c82aeee8SPhilip Paeps    NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
27c82aeee8SPhilip Paeps    DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR
28c82aeee8SPhilip Paeps    OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
29c82aeee8SPhilip Paeps    USE OR OTHER DEALINGS IN THE SOFTWARE.
30*207d96daSPhilip Paeps 
31*207d96daSPhilip Paeps    SPDX-License-Identifier: MIT
32c82aeee8SPhilip Paeps */
33c82aeee8SPhilip Paeps 
34c82aeee8SPhilip Paeps #ifndef FALLTHROUGH_H
35c82aeee8SPhilip Paeps #  define FALLTHROUGH_H 1
36c82aeee8SPhilip Paeps 
37c82aeee8SPhilip Paeps // Explicit fallthrough in switch case to avoid warnings
38c82aeee8SPhilip Paeps // with compiler flag -Wimplicit-fallthrough.
39c82aeee8SPhilip Paeps 
40c82aeee8SPhilip Paeps #  define EXPAT_FALLTHROUGH                                                    \
41c82aeee8SPhilip Paeps     do {                                                                       \
42c82aeee8SPhilip Paeps     } while (0)
43c82aeee8SPhilip Paeps 
44c82aeee8SPhilip Paeps #  if defined(__has_attribute)
45c82aeee8SPhilip Paeps #    if __has_attribute(fallthrough)
46c82aeee8SPhilip Paeps #      undef EXPAT_FALLTHROUGH
47c82aeee8SPhilip Paeps #      define EXPAT_FALLTHROUGH __attribute__((fallthrough))
48c82aeee8SPhilip Paeps #    endif
49c82aeee8SPhilip Paeps #  endif
50c82aeee8SPhilip Paeps 
51c82aeee8SPhilip Paeps #endif // FALLTHROUGH_H
52