From 480fddd189039812d15936adb87e6f16431b1d20 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Wed, 20 Nov 2013 17:22:32 +0100 Subject: [PATCH] build-info: add a nicer way of printing atomics support --- src/suricata.c | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/src/suricata.c b/src/suricata.c index ef1ef9f338..b4c4a31e74 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -662,6 +662,30 @@ void SCPrintBuildInfo(void) { } printf("SIMD support: %s\n", features); + /* atomics stuff */ + memset(features, 0x00, sizeof(features)); +#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1) + strlcat(features, "1 ", sizeof(features)); +#endif +#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) + strlcat(features, "2 ", sizeof(features)); +#endif +#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) + strlcat(features, "4 ", sizeof(features)); +#endif +#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) + strlcat(features, "8 ", sizeof(features)); +#endif +#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16) + strlcat(features, "16 ", sizeof(features)); +#endif + if (strlen(features) == 0) { + strlcat(features, "none", sizeof(features)); + } else { + strlcat(features, "byte(s)", sizeof(features)); + } + printf("Atomic intrisics: %s\n", features); + #if __WORDSIZE == 64 bits = "64-bits"; #elif __WORDSIZE == 32 @@ -681,22 +705,6 @@ void SCPrintBuildInfo(void) { printf("C version %"PRIiMAX"\n", (intmax_t)__STDC_VERSION__); #endif -#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 - printf(" __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1\n"); -#endif -#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 - printf(" __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2\n"); -#endif -#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 - printf(" __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4\n"); -#endif -#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 - printf(" __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8\n"); -#endif -#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 - printf(" __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16\n"); -#endif - #if __SSP__ == 1 printf("compiled with -fstack-protector\n"); #endif