From 5cadd124f882290dff281b6de06d64d92ce73ecd Mon Sep 17 00:00:00 2001 From: Will Estes Date: Sat, 13 May 2017 15:15:45 -0400 Subject: scanner: finish support for noyy{get,set}_column. Unattributed patch carried over from sourceforge bug tracker. --- src/scan.l | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/scan.l') diff --git a/src/scan.l b/src/scan.l index 66db864..3995bcf 100644 --- a/src/scan.l +++ b/src/scan.l @@ -433,6 +433,8 @@ M4QEND "]""]" yyset_extra ACTION_M4_IFDEF("M4""_YY_NO_SET_EXTRA", ! option_sense); yyget_leng ACTION_M4_IFDEF("M4""_YY_NO_GET_LENG", ! option_sense); yyget_text ACTION_M4_IFDEF("M4""_YY_NO_GET_TEXT", ! option_sense); + yyget_column ACTION_M4_IFDEF("M4""_YY_NO_GET_COLUMN", ! option_sense); + yyset_column ACTION_M4_IFDEF("M4""_YY_NO_SET_COLUMN", ! option_sense); yyget_lineno ACTION_M4_IFDEF("M4""_YY_NO_GET_LINENO", ! option_sense); yyset_lineno ACTION_M4_IFDEF("M4""_YY_NO_SET_LINENO", ! option_sense); yyget_in ACTION_M4_IFDEF("M4""_YY_NO_GET_IN", ! option_sense); -- cgit v1.2.3 From 4b5111d9772b5c160340ca96f08d30d7f6db5cda Mon Sep 17 00:00:00 2001 From: Explorer09 Date: Mon, 4 Sep 2017 08:28:53 +0800 Subject: 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 on glibc 2.26+ systems. If we include 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]). Fixes #247. --- src/scan.l | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/scan.l') diff --git a/src/scan.l b/src/scan.l index 3995bcf..4f497ac 100644 --- a/src/scan.l +++ b/src/scan.l @@ -1,5 +1,11 @@ /* scan.l - scanner for flex input -*-C-*- */ +%top{ +/* flexdef.h includes config.h, which may contain macros that alter the API */ +/* of libc functions. Must include first before any libc header. */ +#include "flexdef.h" +} + %{ /* Copyright (c) 1990 The Regents of the University of California. */ /* All rights reserved. */ @@ -32,7 +38,6 @@ /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ /* PURPOSE. */ -#include "flexdef.h" #include "parse.h" extern bool tablesverify, tablesext; extern int trlcontxt; /* Set in parse.y for each rule. */ -- cgit v1.2.3