2
0
mirror of git://github.com/lxc/lxc synced 2025-09-01 17:09:30 +00:00

Merge pull request #3983 from brauner/2021-09-29.fixes

build: compiler attribute improvements
This commit is contained in:
Stéphane Graber
2021-09-29 12:45:09 -04:00
committed by GitHub
2 changed files with 8 additions and 3 deletions

View File

@@ -355,8 +355,13 @@ conf.set10('HAVE_STRCHRNUL', have)
have = cc.has_function('openpty', prefix : '#include <pty.h>', args : '-D_GNU_SOURCE') have = cc.has_function('openpty', prefix : '#include <pty.h>', args : '-D_GNU_SOURCE')
conf.set10('HAVE_OPENPTY', have) conf.set10('HAVE_OPENPTY', have)
conf.set10('HAVE_COMPILER_ATTR_NONNULL', cc.has_function_attribute('nonnull')) foreach ccattr : ['fallthrough',
conf.set10('HAVE_COMPILER_ATTR_RETURNS_NONNULL', cc.has_function_attribute('returns_nonnull')) 'nonnull',
'returns_nonnull',
]
conf.set10('HAVE_COMPILER_ATTR_' + ccattr.underscorify().to_upper(), cc.has_function_attribute(ccattr))
endforeach
config_h = configure_file( config_h = configure_file(
output : 'config.h', output : 'config.h',

View File

@@ -18,7 +18,7 @@
#endif #endif
#endif #endif
#if __GNUC__ >= 7 #if HAVE_COMPILER_ATTR_FALLTHROUGH || __GNUC__ >= 7
#define __fallthrough __attribute__((__fallthrough__)) #define __fallthrough __attribute__((__fallthrough__))
#else #else
#define __fallthrough /* fall through */ #define __fallthrough /* fall through */