]> granicus.if.org Git - flex/commitdiff
scanner: Define _POSIX_C_SOURCE when needed in skeleton.
authorExplorer09 <explorer09@gmail.com>
Fri, 13 Oct 2017 16:36:54 +0000 (00:36 +0800)
committerWill Estes <westes575@gmail.com>
Fri, 3 Nov 2017 14:19:21 +0000 (10:19 -0400)
The function fileno() is defined by POSIX. When flex would otherwise not provide that feature macro, we define it.

Fixes #263

src/flex.skl

index 1191c502701991680a48daa37dff43cd6d9140cf..332d3c038bc3f5e7bdc05a5ea4aae9d4d79956d6 100644 (file)
@@ -218,6 +218,14 @@ m4_ifdef( [[M4_YY_TABLES_EXTERNAL]],
 
 /* begin standard C headers. */
 %if-c-only
+m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]], ,
+[[m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]], ,
+[[#ifndef _POSIX_C_SOURCE
+#define _POSIX_C_SOURCE 1 /* for fileno() */
+#ifndef _POSIX_SOURCE
+#define _POSIX_SOURCE 1
+#endif
+#endif]])]])
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>