merge conflicts

This commit is contained in:
christos 2018-12-23 16:27:17 +00:00
parent 84df641459
commit 596f930c29
13 changed files with 108 additions and 646 deletions

View File

@ -1,5 +1,5 @@
# from: @(#)Makefile 5.4 (Berkeley) 6/24/90
# $NetBSD: Makefile,v 1.11 2017/01/02 18:33:22 christos Exp $
# $NetBSD: Makefile,v 1.12 2018/12/23 16:27:17 christos Exp $
#
# By default, flex will be configured to generate 8-bit scanners only if the
# -8 flag is given. If you want it to always generate 8-bit scanners, add
@ -61,7 +61,7 @@ skel.c: flex.skl mkskel.sh flexint.h tables_shared.h
-DFLEX_MINOR_VERSION=`echo ${VERSION} | cut -f 2 -d .` \
-DFLEX_SUBMINOR_VERSION=`echo ${VERSION} | cut -f 3 -d .` | \
${TOOL_SED} -e 's/m4postproc_/m4_/g' | \
${HOST_SH} ${IDIST}/mkskel.sh > ${.TARGET}
${HOST_SH} ${IDIST}/mkskel.sh ${IDIST} ${TOOL_M4} ${VERSION} > ${.TARGET}
.ifndef HOSTPROG
scan.c: scan.l

View File

@ -1,3 +0,0 @@
# Files in the lib/ subdirectory are picked up as needed by the flex
# build system. As such, we don't need to specify anything beyond
# having a Makefile.am for automake to generate a Makefile.in from.

View File

@ -1,478 +0,0 @@
# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = lib
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/src/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BISON = @BISON@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@
GREP = @GREP@
HELP2MAN = @HELP2MAN@
INDENT = @INDENT@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INTLLIBS = @INTLLIBS@
INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBICONV = @LTLIBICONV@
LTLIBINTL = @LTLIBINTL@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
M4 = @M4@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MSGFMT = @MSGFMT@
MSGFMT_015 = @MSGFMT_015@
MSGMERGE = @MSGMERGE@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
POSUB = @POSUB@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHARED_VERSION_INFO = @SHARED_VERSION_INFO@
SHELL = @SHELL@
STRIP = @STRIP@
TEXI2DVI = @TEXI2DVI@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
WARNINGFLAGS = @WARNINGFLAGS@
XGETTEXT = @XGETTEXT@
XGETTEXT_015 = @XGETTEXT_015@
XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
YACC = @YACC@
YFLAGS = @YFLAGS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign lib/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
tags TAGS:
ctags CTAGS:
cscope cscopelist:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
cscopelist-am ctags-am distclean distclean-generic \
distclean-libtool distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags-am uninstall uninstall-am
.PRECIOUS: Makefile
# Files in the lib/ subdirectory are picked up as needed by the flex
# build system. As such, we don't need to specify anything beyond
# having a Makefile.am for automake to generate a Makefile.in from.
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,49 +0,0 @@
/* $OpenBSD: reallocarray.c,v 1.2 2014/12/08 03:45:00 bcook Exp $ */
/*
* Copyright (c) 2008 Otto Moerbeek <otto@drijf.net>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* OPENBSD ORIGINAL: lib/libc/stdlib/reallocarray.c */
#include <config.h>
#ifndef HAVE_REALLOCARRAY
#undef reallocarray
#include <sys/types.h>
#include <errno.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#include <stdlib.h>
void *reallocarray(void *, size_t, size_t);
/*
* This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
* if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
*/
#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4))
void *
reallocarray(void *optr, size_t nmemb, size_t size)
{
if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
nmemb > 0 && SIZE_MAX / nmemb < size) {
errno = ENOMEM;
return NULL;
}
return realloc(optr, size * nmemb);
}
#endif /* HAVE_REALLOCARRAY */

View File

@ -29,7 +29,7 @@
/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
/* PURPOSE. */
#include "flexdef.h"
__RCSID("$NetBSD: dfa.c,v 1.3 2017/01/02 17:45:27 christos Exp $");
__RCSID("$NetBSD: dfa.c,v 1.4 2018/12/23 16:27:17 christos Exp $");
#include "tables.h"
@ -464,14 +464,9 @@ void ntod (void)
/* We still may want to use the table if numecs
* is a power of 2.
*/
int power_of_two;
for (power_of_two = 1; power_of_two <= csize;
power_of_two *= 2)
if (numecs == power_of_two) {
use_NUL_table = true;
break;
}
if (numecs <= csize && is_power_of_2(numecs)) {
use_NUL_table = true;
}
}
if (use_NUL_table)

View File

@ -1,4 +1,4 @@
/* $NetBSD: filter.c,v 1.3 2017/01/02 17:45:27 christos Exp $ */
/* $NetBSD: filter.c,v 1.4 2018/12/23 16:27:17 christos Exp $ */
/* filter - postprocessing of flex output through filters */
@ -23,7 +23,7 @@
/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
/* PURPOSE. */
#include "flexdef.h"
__RCSID("$NetBSD: filter.c,v 1.3 2017/01/02 17:45:27 christos Exp $");
__RCSID("$NetBSD: filter.c,v 1.4 2018/12/23 16:27:17 christos Exp $");
static const char * check_4_gnu_m4 =
"m4_dnl ifdef(`__gnu__', ,"
@ -179,7 +179,7 @@ clearerr(stdin);
if ((r = chain->filter_func (chain)) == -1)
flexfatal (_("filter_func failed"));
exit (0);
FLEX_EXIT (0);
}
else {
execvp (chain->argv[0],
@ -188,7 +188,7 @@ clearerr(stdin);
chain->argv[0]);
}
exit (1);
FLEX_EXIT (1);
}
/* Parent */
@ -299,7 +299,8 @@ int filter_tee_header (struct filter *chain)
fprintf (to_h, "\n");
/* write a fake line number. It will get fixed by the linedir filter. */
fprintf (to_h, "#line 4000 \"M4_YY_OUTFILE_NAME\"\n");
if (gen_line_dirs)
fprintf (to_h, "#line 4000 \"M4_YY_OUTFILE_NAME\"\n");
fprintf (to_h, "#undef %sIN_HEADER\n", prefix);
fprintf (to_h, "#endif /* %sHEADER_H */\n", prefix);
@ -326,7 +327,7 @@ int filter_tee_header (struct filter *chain)
while (wait (0) > 0) ;
exit (0);
FLEX_EXIT (0);
return 0;
}

View File

@ -6,8 +6,9 @@
%# pre-compilation stage of flex. Only macros starting
%# with `m4preproc_' are processed, and quoting is normal.
%#
%# 2. The preprocessed skeleton is translated verbatim into a
%# C array, saved as "skel.c" and compiled into the flex binary.
%# 2. The preprocessed skeleton is translated into a C array, saved
%# as "skel.c" and compiled into the flex binary. The %# comment
%# lines are removed.
%#
%# 3. At runtime, the skeleton is generated and filtered (again)
%# through m4. Macros beginning with `m4_' will be processed.
@ -114,6 +115,16 @@ m4_ifdef( [[M4_YY_PREFIX]],, [[m4_define([[M4_YY_PREFIX]], [[yy]])]])
m4preproc_define(`M4_GEN_PREFIX',
``[[#define yy$1 ]]M4_YY_PREFIX[[$1]]
%# m4_define([[yy$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'')
m4preproc_define(`M4_GEN_PREFIX',``
[[#ifdef yy$1
#define ]]M4_YY_PREFIX[[$1_ALREADY_DEFINED
#else
#define yy$1 ]]M4_YY_PREFIX[[$1
#endif]]
'm4preproc_divert(1)`
[[#ifndef ]]M4_YY_PREFIX[[$1_ALREADY_DEFINED
#undef yy$1
#endif]]'m4preproc_divert(0)')
%if-c++-only
/* The c++ scanner is a mess. The FlexLexer.h header file relies on the
@ -1682,6 +1693,8 @@ m4_ifdef( [[M4_YY_USES_REJECT]],
(void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size M4_YY_CALL_LAST_ARG );
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
/* "- 2" to take care of EOB's */
YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
}
YY_G(yy_n_chars) += number_to_move;
@ -1914,6 +1927,9 @@ m4_ifdef( [[M4_YY_USE_LINENO]],
*/
void yyFlexLexer::yyrestart( std::istream* input_file )
{
if( ! input_file ) {
input_file = &yyin;
}
yyrestart( *input_file );
}
%endif
@ -2075,7 +2091,7 @@ static void yy_load_buffer_state (M4_YY_DEF_ONLY_ARG)
b->yy_input_file = file;
%endif
%if-c++-only
b->yy_input_file = (&file == 0) ? NULL : file.rdbuf();
b->yy_input_file = file.rdbuf();
%endif
b->yy_fill_buffer = 1;
@ -2453,7 +2469,7 @@ static void yynoreturn yy_fatal_error YYFARGS1(const char*, msg)
{
M4_YY_DECL_GUTS_VAR();
M4_YY_NOOP_GUTS_VAR();
(void) fprintf( stderr, "%s\n", msg );
fprintf( stderr, "%s\n", msg );
exit( YY_EXIT_FAILURE );
}
%endif
@ -3416,4 +3432,5 @@ m4_ifdef( [[M4_YY_IN_HEADER]],
#undef YY_DECL_IS_OURS
#undef YY_DECL
#endif
m4preproc_undivert(1)
]])

View File

@ -1,4 +1,4 @@
/* $NetBSD: flexdef.h,v 1.6 2018/08/20 10:26:58 christos Exp $ */
/* $NetBSD: flexdef.h,v 1.7 2018/12/23 16:27:17 christos Exp $ */
/* flexdef - definitions file for flex */
@ -68,23 +68,24 @@
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#ifdef HAVE_UNISTD_H
/* Required: dup() and dup2() in <unistd.h> */
#include <unistd.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_SYS_PARAMS_H
#include <sys/params.h>
#endif
#ifdef HAVE_SYS_STAT_H
/* Required: stat() in <sys/stat.h> */
#include <sys/stat.h>
#endif
/* Required: wait() in <sys/wait.h> */
#include <sys/wait.h>
#include <stdbool.h>
#ifdef HAVE_REGEX_H
#include <stdarg.h>
/* Required: regcomp(), regexec() and regerror() in <regex.h> */
#include <regex.h>
#endif
/* Required: strcasecmp() in <strings.h> */
#include <strings.h>
#include "flexint.h"
/* We use gettext. So, when we write strings which should be translated, we mark them with _() */
@ -119,6 +120,8 @@
#define ABS(x) ((x) < 0 ? -(x) : (x))
#endif
/* Whether an integer is a power of two */
#define is_power_of_2(n) ((n) > 0 && ((n) & ((n) - 1)) == 0)
#define unspecified -1
@ -853,9 +856,6 @@ extern void flexfatal(const char *);
}while(0)
#endif /* ! HAVE_DECL___func__ */
/* Convert a hexadecimal digit string to an integer value. */
extern unsigned int htoui(unsigned char[]);
/* Report an error message formatted */
extern void lerr(const char *, ...)
#if defined(__GNUC__) && __GNUC__ >= 3
@ -892,9 +892,6 @@ extern int myctoi(const char *);
/* Return character corresponding to escape sequence. */
extern unsigned char myesc(unsigned char[]);
/* Convert an octal digit string to an integer value. */
extern unsigned int otoui(unsigned char[]);
/* Output a (possibly-formatted) string to the generated scanner. */
extern void out(const char *);
extern void out_dec(const char *, int);

View File

@ -1,4 +1,4 @@
/* $NetBSD: flexint.h,v 1.2 2016/01/09 17:38:57 christos Exp $ */
/* $NetBSD: flexint.h,v 1.3 2018/12/23 16:27:17 christos Exp $ */
/* flex integer type definitions */
@ -60,6 +60,10 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U)
#endif
#ifndef SIZE_MAX
#define SIZE_MAX (~(size_t)0)
#endif
#endif /* ! C99 */
#endif /* ! FLEXINT_H */

View File

@ -1,4 +1,4 @@
/* $NetBSD: misc.c,v 1.3 2017/01/02 17:45:27 christos Exp $ */
/* $NetBSD: misc.c,v 1.4 2018/12/23 16:27:17 christos Exp $ */
/* misc - miscellaneous flex routines */
@ -33,7 +33,7 @@
/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
/* PURPOSE. */
#include "flexdef.h"
__RCSID("$NetBSD: misc.c,v 1.3 2017/01/02 17:45:27 christos Exp $");
__RCSID("$NetBSD: misc.c,v 1.4 2018/12/23 16:27:17 christos Exp $");
#include "tables.h"
#include <stdarg.h>
@ -147,9 +147,14 @@ void add_action (const char *new_text)
void *allocate_array (int size, size_t element_size)
{
void *mem;
size_t num_bytes = element_size * (size_t) size;
mem = malloc(num_bytes);
#if HAVE_REALLOCARRAY
/* reallocarray has built-in overflow detection */
mem = reallocarray(NULL, (size_t) size, element_size);
#else
size_t num_bytes = (size_t) size * element_size;
mem = (size && SIZE_MAX / (size_t) size < element_size) ? NULL :
malloc(num_bytes);
#endif
if (!mem)
flexfatal (_
("memory allocation failed in allocate_array()"));
@ -306,18 +311,6 @@ void flexfatal (const char *msg)
}
/* htoui - convert a hexadecimal digit string to an unsigned integer value */
unsigned int htoui (unsigned char str[])
{
unsigned int result;
(void) sscanf ((char *) str, "%x", &result);
return result;
}
/* lerr - report an error message */
void lerr (const char *msg, ...)
@ -517,18 +510,14 @@ unsigned char myesc (unsigned char array[])
int sptr = 1;
while (sptr <= 3 &&
isascii (array[sptr]) &&
isdigit (array[sptr]))
/* Don't increment inside loop control
* because if isdigit() is a macro it might
* expand into multiple increments ...
*/
array[sptr] >= '0' && array[sptr] <= '7') {
++sptr;
}
c = array[sptr];
array[sptr] = '\0';
esc_char = (unsigned char) otoui (array + 1);
esc_char = (unsigned char) strtoul ((const char *)array + 1, NULL, 8);
array[sptr] = c;
@ -539,18 +528,18 @@ unsigned char myesc (unsigned char array[])
{ /* \x<hex> */
int sptr = 2;
while (isascii (array[sptr]) &&
isxdigit (array[sptr]))
while (sptr <= 3 && isxdigit (array[sptr])) {
/* Don't increment inside loop control
* because if isdigit() is a macro it might
* because if isxdigit() is a macro it might
* expand into multiple increments ...
*/
++sptr;
}
c = array[sptr];
array[sptr] = '\0';
esc_char = (unsigned char) htoui (array + 2);
esc_char = (unsigned char) strtoul ((const char *)array + 2, NULL, 16);
array[sptr] = c;
@ -563,17 +552,6 @@ unsigned char myesc (unsigned char array[])
}
/* otoui - convert an octal digit string to an unsigned integer value */
unsigned int otoui (unsigned char str[])
{
unsigned int result;
(void) sscanf ((char *) str, "%o", &result);
return result;
}
/* out - various flavors of outputing a (possibly formatted) string for the
* generated scanner, keeping track of the line count.
*/
@ -686,9 +664,14 @@ char *readable_form (int c)
void *reallocate_array (void *array, int size, size_t element_size)
{
void *new_array;
size_t num_bytes = element_size * (size_t) size;
new_array = realloc(array, num_bytes);
#if HAVE_REALLOCARRAY
/* reallocarray has built-in overflow detection */
new_array = reallocarray(array, (size_t) size, element_size);
#else
size_t num_bytes = (size_t) size * element_size;
new_array = (size && SIZE_MAX / (size_t) size < element_size) ? NULL :
realloc(array, num_bytes);
#endif
if (!new_array)
flexfatal (_("attempt to increase array size failed"));
@ -813,9 +796,6 @@ void skelout (void)
/* %e end linkage-only code. */
OUT_END_CODE ();
}
else if (buf[1] == '#') {
/* %# a comment in the skel. ignore. */
}
else {
flexfatal (_("bad line in skeleton file"));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: regex.c,v 1.3 2017/01/02 17:45:27 christos Exp $ */
/* $NetBSD: regex.c,v 1.4 2018/12/23 16:27:17 christos Exp $ */
/** regex - regular expression functions related to POSIX regex lib. */
@ -23,7 +23,7 @@
/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
/* PURPOSE. */
#include "flexdef.h"
__RCSID("$NetBSD: regex.c,v 1.3 2017/01/02 17:45:27 christos Exp $");
__RCSID("$NetBSD: regex.c,v 1.4 2018/12/23 16:27:17 christos Exp $");
static const char* REGEXP_LINEDIR = "^#line ([[:digit:]]+) \"(.*)\"";
static const char* REGEXP_BLANK_LINE = "^[[:space:]]*$";
@ -55,21 +55,17 @@ void flex_regcomp(regex_t *preg, const char *regex, int cflags)
memset (preg, 0, sizeof (regex_t));
if ((err = regcomp (preg, regex, cflags)) != 0) {
const size_t errbuf_sz = 200;
char *errbuf, *rxerr;
const size_t errbuf_sz = 200;
char *errbuf;
int n;
errbuf = malloc(errbuf_sz * sizeof(char));
if (!errbuf)
flexfatal(_("Unable to allocate buffer to report regcomp"));
rxerr = malloc(errbuf_sz * sizeof(char));
if (!rxerr)
flexfatal(_("Unable to allocate buffer for regerror"));
regerror (err, preg, rxerr, errbuf_sz);
snprintf (errbuf, errbuf_sz, "regcomp for \"%s\" failed: %s", regex, rxerr);
n = snprintf(errbuf, errbuf_sz, "regcomp for \"%s\" failed: ", regex);
regerror(err, preg, errbuf+n, errbuf_sz-(size_t)n);
flexfatal (errbuf);
free(errbuf);
free(rxerr);
flexfatal (errbuf); /* never returns - no need to free(errbuf) */
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: scan.l,v 1.5 2017/01/02 17:45:27 christos Exp $ */
/* $NetBSD: scan.l,v 1.6 2018/12/23 16:27:17 christos Exp $ */
/* scan.l - scanner for flex input -*-C-*- */
@ -34,7 +34,7 @@
/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
/* PURPOSE. */
#include "flexdef.h"
__RCSID("$NetBSD: scan.l,v 1.5 2017/01/02 17:45:27 christos Exp $");
__RCSID("$NetBSD: scan.l,v 1.6 2018/12/23 16:27:17 christos Exp $");
#include "parse.h"
extern bool tablesverify, tablesext;
@ -267,8 +267,7 @@ M4QEND "]""]"
}
. /* ignore spurious characters */
}
<ACTION,CODEBLOCK,ACTION_STRING,PERCENT_BRACE_ACTION,CHARACTER_CONSTANT,
COMMENT,CODE_COMMENT>{
<ACTION,CODEBLOCK,ACTION_STRING,PERCENT_BRACE_ACTION,CHARACTER_CONSTANT,COMMENT,CODE_COMMENT>{
{M4QSTART} ACTION_ECHO_QSTART;
{M4QEND} ACTION_ECHO_QEND;
}
@ -924,7 +923,7 @@ nmstr[yyleng - 2 - end_is_ws] = '\0'; /* chop trailing brace */
{NL} {
++linenum;
ACTION_ECHO;
if (bracelevel == 0 || (doing_codeblock && indented_code)) {
if (bracelevel <= 0 || (doing_codeblock && indented_code)) {
if ( doing_rule_action )
add_action( "\tYY_BREAK]""]\n" );
@ -945,16 +944,16 @@ nmstr[yyleng - 2 - end_is_ws] = '\0'; /* chop trailing brace */
"'" ACTION_ECHO; BEGIN(CHARACTER_CONSTANT);
\" ACTION_ECHO; BEGIN(ACTION_STRING);
{NL} {
++linenum;
ACTION_ECHO;
if (bracelevel == 0) {
if ( doing_rule_action )
add_action( "\tYY_BREAK]""]\n" );
++linenum;
ACTION_ECHO;
if (bracelevel <= 0) {
if ( doing_rule_action )
add_action( "\tYY_BREAK]""]\n" );
doing_rule_action = false;
BEGIN(SECT2);
}
}
doing_rule_action = false;
BEGIN(SECT2);
}
}
. ACTION_ECHO;
}
@ -969,7 +968,7 @@ nmstr[yyleng - 2 - end_is_ws] = '\0'; /* chop trailing brace */
<ACTION_STRING,CHARACTER_CONSTANT>{
(\\\n)* ACTION_ECHO;
\\(\\\n)*. ACTION_ECHO;
{NL} ++linenum; ACTION_ECHO; BEGIN(ACTION);
{NL} ++linenum; ACTION_ECHO; if (bracelevel <= 0) { BEGIN(SECT2); } else { BEGIN(ACTION); }
. ACTION_ECHO;
}

View File

@ -20,11 +20,11 @@
*/
/* #undef HAVE_ALLOCA_H */
/* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the
/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
CoreFoundation framework. */
/* #undef HAVE_CFLOCALECOPYCURRENT */
/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in
/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
the CoreFoundation framework. */
/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */
@ -56,9 +56,6 @@
/* Define to 1 if you have the `m' library (-lm). */
#define HAVE_LIBM 1
/* pthread library */
#define HAVE_LIBPTHREAD 1
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
@ -92,7 +89,7 @@
#define HAVE_REALLOC 1
/* Define to 1 if you have the `reallocarray' function. */
#define HAVE_REALLOCARRAY 1
#undef HAVE_REALLOCARRAY
/* Define to 1 if you have the `regcomp' function. */
#define HAVE_REGCOMP 1
@ -112,6 +109,9 @@
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `strcasecmp' function. */
#define HAVE_STRCASECMP 1
/* Define to 1 if you have the `strchr' function. */
#define HAVE_STRCHR 1
@ -133,6 +133,9 @@
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/wait.h> header file. */
#define HAVE_SYS_WAIT_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
@ -169,7 +172,7 @@
#define PACKAGE_NAME "the fast lexical analyser generator"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "the fast lexical analyser generator 2.6.3"
#define PACKAGE_STRING "the fast lexical analyser generator 2.6.4"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "flex"
@ -178,7 +181,7 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "2.6.3"
#define PACKAGE_VERSION "2.6.4"
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
@ -192,7 +195,7 @@
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "2.6.3"
#define VERSION "2.6.4"
/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
`char[]'. */