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.