| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
| |
Because ENABLE_NLS may be defined to 0 (manually, not through
autoconf) and it's semantically incorrect to only check whether it's
defined.
This is a correction to commit
661d603b65385f62f372acd2017e5af2e0f0cd50.
|
|
|
|
|
|
| |
config.h will have either define ENABLE_NLS or not define it. If it is
not defined we get a -Wundef warning due to using #if with an
undefined macro
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
"%s %s\n" is not translatable
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 a directory containing multiple scanners, we want to allow
specifying the name of the backup file else the backup files will be
overwritten.
|
|
|
|
| |
Unattributed patch carried over from sourceforge bug tracker.
|
|
|
|
|
|
|
| |
This allowed unnamespaced definitions to leak into header files,
breaking client code.
Fixes #142
|
|
|
|
|
| |
Avoid alloca() for SSP; it is better anyway; since we don't need to
strdup the path.
|
|
|
|
| |
Fixes regression introduced in v2.6.3.
|
|
|
|
| |
This avoids a naming conflict in NetBSD's libc.
|
| |
|
|
|
|
|
|
|
|
| |
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.
Fixes #138
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
warning: conversion to 'unsigned int' from 'int' may change the sign of the result [-Wsign-conversion]
|
| |
|
| |
|
|
|
|
| |
[-Wparentheses]
|
| |
|
|
|
|
|
|
|
|
| |
There are two instances in the code which will print a #line directive
to the resulting lexer, regardless of the value of gen_line_dirs. Fix
them, so they also respect gen_line_dirs.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Given the following program:
\#include <libgen.h>
\#include <stdio.h>
/* extracts basename from path, optionally stripping the extension "\.*"
* (same concept as /bin/sh `basename`, but different handling of extension). */
static char *basename2 (char *path)
{
char *b;
for (b = path; *path; path++)
if (*path == '/')
b = path + 1;
return b;
}
static void basename_compare(char *path)
{
printf("basename: %s\n", basename(path));
printf("basename2: %s\n\n", basename2(path));
}
int main (int argc, char *argv[])
{
// From http://pubs.opengroup.org/onlinepubs/9699919799/
// ``Sample Input and Output Strings''
basename_compare("/usr/lib");
basename_compare("/usr/");
basename_compare("/");
basename_compare("///");
basename_compare("//usr//lib//");
return 0;
}
... and the program's output:
basename: lib
basename2: lib
basename: usr
basename2:
basename: /
basename2:
basename: /
basename2:
basename: lib
basename2:
... we can see that basename2() behaves the same as basename(3) in the
average use case, but messes up pretty severely in others. Besides
that, basename(3) is mandated by POSIX so should be present on modern
Unix-like systems, so we shouldn't define it ourselves.
Some notes:
- it doesn't appear to be mentioned in POSIX, but OpenBSD's basename(3)
returns NULL if the returned path componenet is > PATH_MAX, so add a
check for that
- basename(3) shouldn't return an empty string, so remove the
program_name[0] != '\0' check
|
|
|
|
|
|
| |
It's only call site does not activate the `strip_ext` code path, so the
function can be simplified a lot. While here, remove a double
assignment.
|
| |
|
| |
|
|
|
|
|
|
|
| |
It's not called anywhere else so the prototype is not needed.
See the C99 standard [1], section 5.1.2.2.1 for more info.
[1]: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
|
|
|
|
|
|
|
|
| |
As a relic of MS-DOS, we don't need this.
It's never defined; see 13b5b214f53d1c3354a7ab910bd160c126df1331.
Removed additional MSDOS ifdef.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
The function flex_alloc() was just a wrapper around malloc(). Since this only added unclarity, and the flex_alloc() function is likely a legacy of olden times, remove it in favor of calls to malloc() directly.
Style elements cleaned up:
* superfluous spacing around parentheses
* non-constant initialization in variable declarations
* needless casts
* almost all uses of assignments as subexpressions
|
| |
|
| |
|
|
|
|
|
| |
The std:: construct exists as of C++98, so we can simply assume it is
supported.
|
|
|
|
|
|
|
|
| |
Thanks to Michael McConville for pointing out that the old Char macro
causes problems with static analysis. The macro has been removed and
replaced with 'unsigned char' throughout the flex sources. The macro is
not needed at best and was confusing at worst. It was not used in any of
the example files nor was it mentioned in the manual at all.
|
|
|
|
|
|
|
|
| |
flex was using K&R function definitions for some functions and
ANSI C style in others, sometimes even in the same file. Change
the code to consistently use ANSI C.
Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
const fixes.
-Wconversion fixes for the skeleton files.
param namespace protection (add _ to inline function parameters).
unused variable/code removal.
rename warn to lwarn to avoid conflict with <err.h>.
ctype.h function argument correction.
merged the error functions lerrif and lerrsf -> lerr.
|
| |
|
| |
|
|
The *.[chly] sources are now in the src directory. This implies a
bunch of changes in Makefile.am and friends to account for the new
location. The .gitignore files are now more local to places where various object files and generated source files occur.
|