diff options
author | Xavier Leroy <xavier.leroy@college-de-france.fr> | 2019-02-02 16:11:17 +0100 |
---|---|---|
committer | Xavier Leroy <xavierleroy@users.noreply.github.com> | 2019-02-04 16:18:43 +0100 |
commit | d66bd1f776784e87e8583b2c064c518c15973191 (patch) | |
tree | b474ccb49d680a279b0556fbefd5d34341ffabc6 /test/spass/rules-red.c | |
parent | 5382c3cc9b24f59a050b4ef862cab392fa33ed30 (diff) | |
download | compcert-d66bd1f776784e87e8583b2c064c518c15973191.tar.gz compcert-d66bd1f776784e87e8583b2c064c518c15973191.zip |
<stddef.h>: define NULL with type void *
ISO C2011 7.19 para 3 says "NULL, which expands to an implementation-defined null pointer constant"
ISO C2011 6.3.2.3 para 3 says "An integer constant expression with the value 0, or such an expression cast to type void *, is called a null pointer constant."
So, it seems NULL can be defined either as "0" or as "(void *) 0". However, the two definitions are not equivalent in the context of a call to a variadic or unprototyped function: passing 0 when the function expects a pointer value can go wrong if sizeof(int) != sizeof(void *).
This commit changes the definition of NULL to the safer one:
This is what GCC and Clang do in C mode; they use "#define NULL 0" for C++ only.
Fixes issue #265
Diffstat (limited to 'test/spass/rules-red.c')
0 files changed, 0 insertions, 0 deletions