X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=pb.h;h=5e9fad214d2b027236b923d5a4ef17f0b4f2ebd5;hb=871e5be9dd6bb69e2bee2d8e23d27b89285c8f8b;hp=cfcf6f75a6b8403cf3da7774bc3e70e0df57faf4;hpb=08391f35eeeac9583c9ae5010e5e37ca2a5bc0a4;p=apps%2Fagl-service-can-low-level.git diff --git a/pb.h b/pb.h index cfcf6f75..5e9fad21 100644 --- a/pb.h +++ b/pb.h @@ -6,7 +6,7 @@ * see pb_encode.h or pb_decode.h */ -#define NANOPB_VERSION nanopb-0.1.7-dev +#define NANOPB_VERSION nanopb-0.1.8-dev #include #include @@ -24,9 +24,13 @@ #define UNUSED(x) (void)(x) #endif -/* Compile-time assertion, used for checking compatible compilation options. */ +/* Compile-time assertion, used for checking compatible compilation options. + * If this fails on your compiler for some reason, use #define STATIC_ASSERT + * to disable it. */ #ifndef STATIC_ASSERT -#define STATIC_ASSERT(COND,MSG) typedef char static_assertion_##MSG[(COND)?1:-1]; +#define STATIC_ASSERT(COND,MSG) typedef char STATIC_ASSERT_MSG(MSG, __LINE__, __COUNTER__)[(COND)?1:-1]; +#define STATIC_ASSERT_MSG(MSG, LINE, COUNTER) STATIC_ASSERT_MSG_(MSG, LINE, COUNTER) +#define STATIC_ASSERT_MSG_(MSG, LINE, COUNTER) static_assertion_##MSG##LINE##COUNTER #endif /* Number of required fields to keep track of