X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/1e5d654019cc146ff41e8ea4a94c7a111ea9f037..5aaad6c43154f3e69c4e49616d29b1f95b012881:/data/c.m4 diff --git a/data/c.m4 b/data/c.m4 index 41f56956..14db807b 100644 --- a/data/c.m4 +++ b/data/c.m4 @@ -171,16 +171,31 @@ m4_define([b4_table_value_equals], [[YYID (0)]], [[((]$2[) == (]$3[))]])]) + ## ---------## ## Values. ## ## ---------## -# b4_null ---------- -# Return a null pointer constant. NULL infringes on the user name -# space in C, so use 0 rather than NULL. -m4_define([b4_null], [0]) +# b4_null_define +# -------------- +# Portability issues: define a YY_NULL appropriate for the current +# language (C, C++98, or C++11). +m4_define([b4_null_define], +[# ifndef YY_NULL +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULL nullptr +# else +# define YY_NULL 0 +# endif +# endif[]dnl +]) + + +# b4_null +# ------- +# Return a null pointer constant. +m4_define([b4_null], [YY_NULL]) # b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT) # -------------------------------------------------------------