Kang-Che Sung [Fri, 23 Feb 2018 03:07:29 +0000 (11:07 +0800)]
travis: Hard-code hashes for verifying tarballs
GPG signatures require an external keyserver which might be offline,
which is undesirable for build server use. It's equally secure to just
hard-code the hashes, provided they're trusted (i.e. you verify a hash
against a GPG signature once).
Fixes: #311.
As a side note: the original two signatures
(gettext-0.19.8.1.tar.lz.sig and automake-1.15.1.tar.gz.sig) are signed
against the files' SHA-1 hash.
Explorer09 [Tue, 27 Feb 2018 01:10:12 +0000 (09:10 +0800)]
build: Move dnl comments out of AC_CHECK_FUNCS
Due to a bug, autoheader (2.69) will treat M4 dnl comments in a quoted
argument of AC_CHECK_FUNCS as function tokens and generate a lot of
redundant and useless HAVE_* macros in config.h.in.
(Examples: HAVE_DNL, HAVE_AVAILABLE_, HAVE_BY)
It seems to be this commit dbb4e94dc7bacbcfd4acef4f085ef752fe1aa03f of
mine that revealed this autoheader bug, and the affected config.h.in
had been shipped within flex-2.6.4 release tarball.
I have reported the autoheader bug here:
<https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html>
As a workaround, let's move comments out of AC_CHECK_FUNCS.
Explorer09 [Mon, 30 Oct 2017 05:29:26 +0000 (13:29 +0800)]
Obsolete yypad64() macro.
Slightly rewrite the logic in yytbl_data_load() and yytbl_write_pad64()
so they simply check if the bytes read/written are in 8-byte boundary.
No need to calculate how many bytes we need to pad. (Incidentally this
makes smaller code in x86_64.)
For yytbl_hdr_init(), just expand the calculation from the macro.
Explorer09 [Fri, 13 Oct 2017 16:31:01 +0000 (00:31 +0800)]
scanner: temporarily protect against ccl overflow & overwriting.
For ccladd(), if cclp given is a non-last ccl, adding a char into it
will overflow the buffer and overwrite the first char in the next ccl.
For now, add a temporary detection and protection code. (Not sure if
this could happen in user input, but if it could, then you can expect
some "corrupted" behavior for generated scanners.)
scanner: Include flexdef.h at %top block of scan.l
config.h may define macros that alter the API of the standard library
funtions, and so it should be included before any other standard
header, even before the skeleton's standard header inclusion.
For example: config.h may #define _GNU_SOURCE that would expose the
reallocarray() prototype from <stdlib.h> on glibc 2.26+ systems. If we
include <stdlib.h> before config.h, reallocarray() would not be
available for use in lex file since the second include doesn't help
due to header guard.
For now our config.h might `#define malloc rpl_malloc` -- this
substitution must work before including stdlib.h, or else the compiler
will complain about missing prototypes, and may result in incorrect
code in scan.l (gcc warning: return makes pointer from integer without
a cast [-Wint-conversion]).
Don't use program_name in the description of -T/--trace or -V/--version
option. It's ugly when user invokes flex with a long path like
"/home/username/tools/bin/my-custom-built-flex".
This solution is not long term. If possible, the help text should be
modified so that the "flex" name is no longer needed below the first
"Usage:" line. All translations of help text will need to be updated
as well.
scanner: remove BASENAME(); don't strip path from program_name
There's no technical need of stripping path from program_name. I think
the users should be fine if they see the path they use to invoke flex
is diagnostic messages and help texts.
Yes, users will see "Usage: ../flex [OPTIONS]..." now if they invoke
flex with the path "../flex".
The --version output has been changed so that the name field will be
always "flex" or "flex++". If the flex program has been renamed to
"lex" (for compatibility or other reason) this will allow identifying
the implementation name ("flex"). (And it's a recommended practice in
GNU Coding Standards)
In skeleton files comments are indicated by leading `%#` and when
directly read in using `flex -S <skeleton.skl>` they should be
ignored. Example: `flex.skl`.
It's simply to return (regexec(®ex_blank_line, str, 0, NULL, 0) == 0);
The reason for encapsulation is to allow replacing this with a
non-regex method if necessary.
viktor.shepel [Tue, 20 Jun 2017 14:03:42 +0000 (17:03 +0300)]
filter: memory leak free scanner postprocessing.
**Issue:**
Scanner postprocessing leaks memory during correction of `#line`
directives values and generation of C header file.
**Root cause:**
`filter_fix_linedirs` and `filter_tee_header` functions do not
dispose allocated memory.
**Solution:**
Automatically reclaim affected memory by allocating it on stack
insted of heap. Stack allocation should not be a problem as its
only 512 bytes and there is no recursive calls.
Thomas Klausner [Fri, 19 May 2017 08:22:44 +0000 (10:22 +0200)]
scanner: Use reallocarr() when available.
NetBSD had a crash during build. Since the provided substitute for
reallocarray() wasn't working, use NetBSD's reallocarr(). Let
configure choose that function whenever it is available. Use
reallocarray if available. Still fallback if neither is available.
Jeff Smith [Sat, 1 Apr 2017 06:18:12 +0000 (01:18 -0500)]
filter: Output correct #line value for current file.
A #line pre-processor directive specifies the line number and source
file of the following lines. If the source file _is_ the current file,
the line number should be that of the line following the directive. So
the specified line number should be the current line number plus 1.
test: rename some files for non-case-sensitive filesystems.
-C*f and -C*F option-specific test files collide on case-insensitive
file systems, and cause tests to either not be run at all, or to
overwrite each other's files at build time. So rename -C*F ones to
-C*_F.
Explorer09 [Wed, 3 May 2017 03:48:06 +0000 (11:48 +0800)]
build: do not generate lib/Makefile.in.
Files in lib/ are picked up and built using makefile directives in
src/Makefile.am. Remove the need to generate lib/Makefile.in and the
stub lib/Makefile.am.
* Don't call isascii() here. It's deprecated in POSIX and not needed
for myesc's case.
* The check of the character class and range here should match what's
defined as {ESCSEQ} in scan.l, so for [[:xdigit:]] we use isxdigit();
for [0-7] we check '0' <= c <= '7' (not isdigit(c) because isdigit is
locale-dependant in standard's sense)
* Add missing length limit for "\x<hex>" (<hex> is at most 2 digits)
Simon Sobisch [Tue, 2 May 2017 15:26:07 +0000 (17:26 +0200)]
gettext: more recent makevars; new script to update po files.
Previously, "make dist" and similar commands would cause the po files
to be updated, which is incorrect. The more recent version now used
should not do this.
Replaced Rules-getpo by extra script to manually update and rebuild all po files.
Simon Sobisch [Tue, 2 May 2017 15:15:45 +0000 (17:15 +0200)]
gettext: list generated files instead of flex, bison sources in POTFILES.in.
Listing the flex and bison sources -- as the gettext manual suggests
-- causes warnings. Listing the generated C files for the lexer and
parser removes the warnings. Since both files contain line directives,
any translator who needs to refer back to those files should be able
to find the context in which strings are needed.
Simon Sobisch [Tue, 2 May 2017 10:04:00 +0000 (12:04 +0200)]
build: check for how to call libtoolize.
Previously, we would call libtoolize and if that failed, we would call
glibtoolize since some platforms have the libtoolize program under
that name.
Instead, we check to see if the environment variable LIBTOOLIZE is set
and use that if so. Otherwise, we try to find a program "libtoolize"
on the path and failing that glibtoolize. We alert the user if no
suitable program can be found.
Alastair Hughes [Fri, 6 Jan 2017 06:06:03 +0000 (19:06 +1300)]
build: support cross compiling.
Check for cross compiling. If cross compiling, build stage1flex using a
custom link command.
We also override LDADD since that adds the replacement implementations
that are cross compiled, and instead always use the replacement library
implementations.
We don't use BUILD_OBJEXT and BUILD_EXEEXT since it seems that automake
does not support these.
Explorer09 [Fri, 17 Feb 2017 15:19:10 +0000 (23:19 +0800)]
build: Include <strings.h>; add strcasecmp() check to configure.
strings.h (not string.h) is the standard-defined include header for
strcasecmp(). Include <strings.h> for portability (even though glibc
exposes strcasecmp() declaration also in <string.h> by default).
Explorer09 [Sun, 12 Feb 2017 11:59:52 +0000 (19:59 +0800)]
scanner: compute powers of two faster.
Replace the naive "for" loop in determining power of two with a clever
bitwise solution. This code is around the Internet already and is in
Public Domain.
Explorer09 [Tue, 7 Feb 2017 13:14:04 +0000 (21:14 +0800)]
test: skip pthread test when needed files missing.
"Unlisting" the pthread test when libpthread is not available is never
a good idea. Should let it compile into a stub program that returns
the "skip" status.
configure.ac and tests/Makefile.am are edited so that pthread test can
be built anyway, but only works (not as the stub) when both pthread.h
and libpthread are detected on the system.
Also fix a small typo in tests/pthread.l comments.
Will Estes [Thu, 16 Feb 2017 14:27:22 +0000 (09:27 -0500)]
build: mv scan.c when building dist.
Revert change to copy scan.c when building the distribution
archive. Move it instead. This satisfies automake's notions of what
should be clean and ensures that the distribution archive contains a
just-built copy of scan.c.