awslabs/aws-c-common

Preprocessor error in SIZE_MAX: missing binary operator before token "0"

philippbara opened this issue · 3 comments

Description

I run into a preprocessor error in SIZE_MAX while building the V2X framework Artery against the CPP SDK. The ITS-G5 network stack is provided by Vanetza. Vanetza defines SIZE_MAX in asn_system.h as follows: #define SIZE_MAX ((~((size_t)0)) >> 1). This leads to an error in math.h:16:
error

Steps to reproduce

The issue can easily be reproduced by defining SIZE_MAX as ((~((size_t)0)) >> 1) instead of a non constant integral like 18446744073709551615UL (taken from stdint.h).

Solution

Came across a similar issue in crypto++. Redefining SIZE_MAX like here solved the issue for me.

System info:

Linux 5.15.0-47-generic 51-Ubuntu SMP Thu Aug 11 07:51:15 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
gcc 11.2.0
AWS_SDK_VERSION_STRING "1.9.348"