Explorer09 [Tue, 3 Jan 2017 13:00:15 +0000 (21:00 +0800)]
test: let testwrapper scripts be run by ${SHELL}.
This allows user to use a different shell if /bin/sh has problems.
The use of $SHELL (variable) to run scripts is already an Automake
convention. All shell scripts in build-aux are run by $SHELL.
Explorer09 [Sun, 1 Jan 2017 16:43:50 +0000 (00:43 +0800)]
test: exit on '-1' test non-zero status.
If a '-1' test program returns a non-zero status, don't go further and
compare it's (numeric) output values. This allows a '-1' test to
indicate a "skip" status or an otherwise error. (Currently no such '-1'
test would skip like this, though.)
Shell syntax note: `set -e` will not exit with the syntax like this
`test $(false) = $(false);`. The exit statuses of `false` in the
example will be ignored instead. But putting the output in a variable,
such as `VAR=$(false)`, DOES exit.
Explorer09 [Sun, 1 Jan 2017 16:38:37 +0000 (00:38 +0800)]
build: Fix 'make indent' target
This 'make indent' target has not been working since the directories
reorganization in flex 2.6.0. Now make it work again.
Note that the current indent profile breaks many styles of existing
code. The indent target should not be used until the .indent.pro
options are reviewed for desireability.
Tobias Klauser [Thu, 12 Jan 2017 09:49:32 +0000 (10:49 +0100)]
filter: Don't emit #line if %option noline set
One place emitting a #line directive to the generated header was
missed in commit 647a92b9f4 when resolving #55. Fix it to respect
gen_line_dirs as well.
Harald van Dijk [Tue, 10 Jan 2017 21:37:49 +0000 (22:37 +0100)]
c++: Fix yyrestart(NULL) SEGV.
Binding a reference to a dereferenced null pointer is invalid and
compilers optimise away the &file == 0 check. We need a real stream.
yyin is available already, and yyrestart(NULL) is only supported when
yyin will not be used, so there is no harm in just passing in that.
Since we now always have a valid stream, we can skip the null check
too.
Explorer09 [Sat, 26 Nov 2016 15:47:12 +0000 (23:47 +0800)]
build: New configure option '--disable-bootstrap'.
If configure is run with '--disable-bootstrap', then stage1flex won't
be built and stage1scan.c will be generated by sed'ing scan.c.
This option is intended to workaround bootstrap bugs rather than to
fix the bootstrapping issues which are proving subtler and harder to
fix than anyone would like.
Explorer09 [Sat, 26 Nov 2016 09:21:25 +0000 (17:21 +0800)]
build: allow building libfl even with --disable-libfl.
For various reasons, we may wish to build libfl explicitly even when
configure has been run with the --disable-libfl option. This is
possible, now, via 'make -C src libfl.la'.
Samuel Thibault [Thu, 29 Dec 2016 13:44:22 +0000 (08:44 -0500)]
scanner: allocate correct buffer size for m4 path.
Flex did not check the length of the m4 path which could lead to a
buffer overflow in some cases. Additionally, not all platforms believe
in PATH_MAX, so stop relying on it.
Explorer09 [Fri, 18 Nov 2016 18:37:04 +0000 (02:37 +0800)]
build: Link $(LIBOBJS) from src/ dir, remove libcompat.la.
The libcompat.la library was small and less friendly to bootstrapping
and cross compilation. Now, we will simply link individual object
files as needed, which is simpler.
Alastair Hughes [Thu, 27 Oct 2016 22:19:31 +0000 (11:19 +1300)]
build: fix false negatives for help2man and texi2dvi
HELP2MAN and TEXI2DVI (or the corresponding ac_prog variables) will
never be zero length as they fall back to the missing script; check for
the fall back and warn on that instead of always warning.
Explorer09 [Fri, 28 Oct 2016 00:37:49 +0000 (08:37 +0800)]
doc: Don't delete flex.1 during "make distclean".
flex.1 is pre-generated in release tarball. If we delete it, the next
"configure and make" on the source directory will then require help2man
unnecessarily.
Alastair Hughes [Thu, 27 Oct 2016 03:48:49 +0000 (16:48 +1300)]
Only regenerate the man page when required.
Make the flex binary an order-only prerequisite, and add back the
prerequisites from before 7cfb440. This prevents rebuilding the man page
whenever the flex binary is rebuilt, which causes problems if help2man
is not installed and will never work when cross compiling.
Will Estes [Wed, 26 Oct 2016 15:14:13 +0000 (11:14 -0400)]
build: no longer build PIC version of libfl.
The PIC version of libfl was not being built correctly. From the lack
of bug reports around this problem, we conclude that the PIC version
of libfl is not used and so we drop it from the build build targets
for flex.
Explorer09 [Tue, 25 Oct 2016 13:23:37 +0000 (21:23 +0800)]
doc: README.md formatting fixes
* Wrap everything in the raw document in 72 char per line limit.
* Proper casing for terms "Git" and "GitHub" (don't try to look lazy).
* Add unordered list marks when needed.
* Say `configure && make && make install` and quoted for fixed-width
font.
This fixes M4 quotation of certain strings beginning with `yy` (in
section 3 of the input file only) and character literals. The new
quotation method is also less brittle and faster.
Tests that relied on the old behavior were fixed.
Also, `yyconst` is no longer defined; use `const` (which it
unconditionally was defined to) instead.
This fixes M4 quoting of section 3 of the input file, including escape
sequences and character constants.
Tests were added to verify the behavior in section 3 with respect to
quoting. Both escaping of quotes and quoting of potential macro-start
characters are tested. Existing tests were also fixed to account for the new -- and now correct -- behavior. Many tests relied on the old behavior of expanding M4 macros
in section 3. They needed to be updated for the new behavior.
Currently, every call to sf_push() realloc()'s _sf_stack, even if the
maximum size _sf_max wasn't changed. As the indentation beneath the
"if" clause already indicates, the realloc() should only be executed
if _sf_max was increased.
Found by compiling flex with the -Wmisleading-indentation flags of gcc,
which leads to the following warning:
scanflags.c: In function ‘sf_push’:
scanflags.c:42:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if (_sf_top_ix + 1 >= _sf_max)
^~
scanflags.c:44:9: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
_sf_stk = realloc(_sf_stk, sizeof(scanflags_t) * _sf_max);
^~~~~~~
rlar [Thu, 31 Mar 2016 13:21:48 +0000 (15:21 +0200)]
fix stage1scan.c and stage1scan.l dependency
git clean -fdx && ./autogen.sh && \
mkdir -p ../build && cd ../build && ../flex/configure && make -j10
failed with:
> ../src/stage1flex -o stage1scan.c stage1scan.l
> stage1flex: can't open stage1scan.l
Note:
stage1scan.c is not necessairy in the "make dist" generated tar.gz file.
stage1flex will be build from scan.c (which is distributed),
and this will then generate stage1scan.c from scan.l
Tobias Klauser [Thu, 31 Mar 2016 08:09:57 +0000 (10:09 +0200)]
Fix potential buffer overflow in strncat()
When using clang/llvm 3.8 to compile flex, the following warning is
emitted:
main.c:378:27: warning: the value of the size argument in 'strncat' is too large, might lead to a buffer overflow [-Wstrncat-size]
strncat(m4_path, m4, sizeof(m4_path));
^~~~~~~~~~~~~~~
main.c:378:27: note: change the argument to be the free space in the destination buffer minus the terminating null byte
strncat(m4_path, m4, sizeof(m4_path));
^~~~~~~~~~~~~~~
sizeof(m4_path) - strlen(m4_path) - 1
Fix it up by using the solution proposed by the warning message.