mirror of
https://github.com/samba-team/samba.git
synced 2025-01-08 21:18:16 +03:00
lib:replace: Add FALL_THROUGH support
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
76535df324
commit
05dae361b3
@ -47,6 +47,7 @@ flags = [
|
||||
'-D_XOPEN_SOURCE_EXTENDED=1',
|
||||
'-DAD_DC_BUILD_IS_ENABLED=1',
|
||||
'-DHAVE_IPV6=1',
|
||||
'-DFALL_THROUGH',
|
||||
'-I/usr/local/include',
|
||||
'-I.',
|
||||
'-Iauth',
|
||||
|
@ -922,6 +922,15 @@ void rep_setproctitle(const char *fmt, ...) PRINTF_ATTRIBUTE(1, 2);
|
||||
#define setproctitle_init rep_setproctitle_init
|
||||
void rep_setproctitle_init(int argc, char *argv[], char *envp[]);
|
||||
#endif
|
||||
|
||||
#ifndef FALL_THROUGH
|
||||
# ifdef HAVE_FALLTHROUGH_ATTRIBUTE
|
||||
# define FALL_THROUGH __attribute__ ((fallthrough))
|
||||
# else /* HAVE_FALLTHROUGH_ATTRIBUTE */
|
||||
# define FALL_THROUGH ((void)0)
|
||||
# endif /* HAVE_FALLTHROUGH_ATTRIBUTE */
|
||||
#endif /* FALL_THROUGH */
|
||||
|
||||
bool nss_wrapper_enabled(void);
|
||||
bool nss_wrapper_hosts_enabled(void);
|
||||
bool socket_wrapper_enabled(void);
|
||||
|
@ -249,6 +249,42 @@ def configure(conf):
|
||||
headers='stdint.h sys/atomic.h',
|
||||
msg='Checking for atomic_add_32 compiler builtin')
|
||||
|
||||
conf.CHECK_CODE('''
|
||||
#define FALL_THROUGH __attribute__((fallthrough))
|
||||
|
||||
enum direction_e {
|
||||
UP = 0,
|
||||
DOWN,
|
||||
};
|
||||
|
||||
int main(void) {
|
||||
enum direction_e key = UP;
|
||||
int i = 10;
|
||||
int j = 0;
|
||||
|
||||
switch (key) {
|
||||
case UP:
|
||||
i = 5;
|
||||
FALL_THROUGH;
|
||||
case DOWN:
|
||||
j = i * 2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (j < i) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
''',
|
||||
'HAVE_FALLTHROUGH_ATTRIBUTE',
|
||||
addmain=False,
|
||||
cflags='-Werror',
|
||||
msg='Checking for fallthrough attribute')
|
||||
|
||||
# these may be builtins, so we need the link=False strategy
|
||||
conf.CHECK_FUNCS('strdup memmem printf memset memcpy memmove strcpy strncpy bzero', link=False)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user