Squashed commit of the following:
commit
4d7e8a276f0d2e0e901b548d781de6af83fd9d07
Author: Michael Altizer <mialtize@cisco.com>
Date: Fri Jul 7 13:56:26 2017 -0400
build: Add support for appending EXTRABUILD to the BUILD string
If EXTRABUILD is defined in the preprocessor flags, it will be appended
to the BUILD string and reported in all such places that use it like
snort -V.
For example, if one configures with CPPFLAGS="-DEXTRABUILD=.1", the
resulting snort -V output will look something like this:
,,_ -*> Snort++ <*-
o" )~ Version 3.0.0-a4 (Build 236.1) from 2.9.8-383
'''' By Martin Roesch & The Snort Team
#include "framework/base_api.h"
#include "framework/decode_data.h"
+#include "utils/cpp_macros.h"
struct TextLog;
struct _daq_pkthdr;
}
// Used by root codecs to add their DLT to their HELP string
-#define STRINGIFY(x) #x
-#define ARG_STRINGIFY(x) STRINGIFY(x)
-#define ADD_DLT(help, x) help " (DLT " ARG_STRINGIFY(x) ")"
+#define ADD_DLT(help, x) help " (DLT " STRINGIFY_MX(x) ")"
constexpr uint8_t MIN_TTL = 64;
constexpr uint8_t MAX_TTL = 255;
#ifndef BUILD_H
#define BUILD_H
+#include "utils/cpp_macros.h"
+
//-----------------------------------------------//
// ____ _ //
// / ___| _ __ ___ _ __| |_ _ _ //
// //
//-----------------------------------------------//
-#define BUILD "236"
+#define BUILD_NUMBER 236
+
+#ifndef EXTRABUILD
+#define BUILD STRINGIFY_MX(BUILD_NUMBER)
+#else
+#define BUILD STRINGIFY_MX(PPCAT_MX(BUILD_NUMBER, EXTRABUILD))
+#endif
#endif
// Miscellaneous C preprocessor macros
+// Turn x into a string literal without expanding macro definitions
+// Example:
+// #define BUILD 123
+// STRINGIFY(BUILD)
+// Result:
+// "BUILD"
#define STRINGIFY(x) #x
+// Turn x into a string literal after macro-expanding it
+// Example:
+// #define BUILD 123
+// STRINGIFY_MX(BUILD)
+// Result:
+// "123"
+#define STRINGIFY_MX(x) STRINGIFY(x)
+
+// Concatenate preprocessor tokens x and y without expanding macro definitions
+// Example:
+// #define ice snow
+// #define cream cone
+// PPCAT(ice, cream)
+// Result:
+// icecream
+#define PPCAT(x, y) x ## y
+
+// Concatenate preprocessor tokens x and y after macro-expanding them
+// Example:
+// #define ice snow
+// #define cream cone
+// PPCAT_MX(ice, cream)
+// Result:
+// snowcone
+#define PPCAT_MX(x, y) PPCAT(x, y)
+
// Pair of macros to temporarily enable and then disable warnings for structures
// being automatically padded. Currently implemented for Clang and GCC >= 5.0.
#if defined(__clang__) && !defined(__ICC)