-
Notifications
You must be signed in to change notification settings - Fork 565
Closed
Milestone
Description
I caught this warning when building flex in -std=c99
mode:
./stage1flex -o stage1scan.c ./scan.l
CC flex-stage1scan.o
stage1scan.c: In function ‘yy_init_buffer’:
stage1scan.c:4757:48: warning: implicit declaration of function ‘fileno’; did you mean ‘mblen’? [-Wimplicit-function-declaration]
b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
^~~~~~
mblen
In glibc, fileno() prototype is exposed only if _POSIX_C_SOURCE
is defined to >= 1
. Although flex will build with _GNU_SOURCE
defined (AC_USE_SYSTEM_EXTENSIONS in configure script), the problem is that generated scanners may not build if the user's environment requires strict ISO C99, and I consider this a bug.
So this issue report is about two things:
- The
#define _POSIX_C_SOURCE 1
is missing in flex.skl when the scanner is specified neitheralways-interactive
ornever-interactive
option. - We didn't document that we use POSIX functions to detect whether the input is "interactive", and so brings surprise to users that expect it builds in non-POSIX environments.
Metadata
Metadata
Assignees
Labels
No labels