Skip to content

Commit

Permalink
build: compiler attribute improvements
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Sep 29, 2021
1 parent 6187bcb commit ff354ed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,13 @@ conf.set10('HAVE_STRCHRNUL', have)
have = cc.has_function('openpty', prefix : '#include <pty.h>', args : '-D_GNU_SOURCE')
conf.set10('HAVE_OPENPTY', have)

conf.set10('HAVE_COMPILER_ATTR_NONNULL', cc.has_function_attribute('nonnull'))
conf.set10('HAVE_COMPILER_ATTR_RETURNS_NONNULL', cc.has_function_attribute('returns_nonnull'))
foreach ccattr : ['fallthrough',
'nonnull',
'returns_nonnull',
]

conf.set10('HAVE_COMPILER_ATTR_' + ccattr.underscorify().to_upper(), cc.has_function_attribute(ccattr))
endforeach

config_h = configure_file(
output : 'config.h',
Expand Down
2 changes: 1 addition & 1 deletion src/lxc/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#endif
#endif

#if __GNUC__ >= 7
#if HAVE_COMPILER_ATTR_FALLTHROUGH
#define __fallthrough __attribute__((__fallthrough__))
#else
#define __fallthrough /* fall through */
Expand Down

0 comments on commit ff354ed

Please sign in to comment.