diff options
author | Akim Demaille <akim.demaille@gmail.com> | 2021-10-23 06:01:44 +0200 |
---|---|---|
committer | Akim Demaille <akim.demaille@gmail.com> | 2021-11-06 09:00:58 +0100 |
commit | c83425ef4e1c66c81d328338e6bf98f5e3c33b81 (patch) | |
tree | 74ff6c21cd05cfe4033e0cbff08a90bf002056d0 /examples | |
parent | c9b5b46d744766396db52b97a9e3a1f61f9e742a (diff) | |
download | bison-c83425ef4e1c66c81d328338e6bf98f5e3c33b81.tar.gz |
tests: address portability issues about strdup
Reported by Dennis Clarke
<https://lists.gnu.org/r/bug-bison/2021-10/msg00005.html>.
In particular
<https://lists.gnu.org/r/bug-bison/2021-10/msg00023.html>.
* doc/bison.texi, examples/c/glr/c++-types.y,
* examples/c/bistromathic/parse.y tests/testsuite.h:
Define _XOPEN_SOURCE to 600, to get a strdup that works on Solaris.
* tests/glr-regression.at: Use strdup freely.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/c/bistromathic/parse.y | 5 | ||||
-rw-r--r-- | examples/c/glr/c++-types.y | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/examples/c/bistromathic/parse.y b/examples/c/bistromathic/parse.y index fbdeb7fc..5c1e6055 100644 --- a/examples/c/bistromathic/parse.y +++ b/examples/c/bistromathic/parse.y @@ -21,6 +21,11 @@ // Emitted on top of the implementation file. %code top { + /* Portability issues for strdup. */ + #ifndef _XOPEN_SOURCE + # define _XOPEN_SOURCE 600 + #endif + #include <ctype.h> // isdigit #include <locale.h> // LC_ALL #include <math.h> // cos, sin, etc. diff --git a/examples/c/glr/c++-types.y b/examples/c/glr/c++-types.y index 4c978386..ff1b62fb 100644 --- a/examples/c/glr/c++-types.y +++ b/examples/c/glr/c++-types.y @@ -53,6 +53,10 @@ %code { + /* Portability issues for strdup. */ +#ifndef _XOPEN_SOURCE +# define _XOPEN_SOURCE 600 +#endif #include <assert.h> #include <ctype.h> |