[Bug 233481] flex/lex: __dead2 define in flex.skl precludes cross compiles for embedded systems
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Sat Nov 24 21:13:51 UTC 2018
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=233481
Bug ID: 233481
Summary: flex/lex: __dead2 define in flex.skl precludes cross
compiles for embedded systems
Product: Base System
Version: 11.2-RELEASE
Hardware: Any
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: bin
Assignee: bugs at FreeBSD.org
Reporter: leres at freebsd.org
We're unable to compile a lex generated module for the openvehicles.com project
with the devel/xtensa-esp32-elf toolchain. The problem is the flex/lex
generated code unconditionally defines __dead2 when !defined(__FreeBSD__):
In file included from
/home/leres/esp/openvehicles-xtensa-esp32-elf/components/newlib/include/stdio.h:35:0,
from
/home/leres/src/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/components/dbc/yacclex/dbc_tokeniser.c:30:
/home/leres/esp/openvehicles-xtensa-esp32-elf/components/newlib/include/sys/cdefs.h:246:0:
warning: "__dead2" redefined
#define __dead2 __attribute__((__noreturn__))
^
/home/leres/src/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/components/dbc/yacclex/dbc_tokeniser.c:26:0:
note: this is the location of the previous definition
#define __dead2
The problem is the generated code unconditionally defines __dead2:
/* First, we deal with platform-specific or compiler-specific issues. */
#if defined(__FreeBSD__)
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS
#endif
#include <sys/cdefs.h>
#include <stdint.h>
#else
#define __dead2
#endif
And then later includes stdio.h:
/* begin standard C headers. */
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
/* end standard C headers. */
But stdio.h causes the xtensa-esp32-elf version sys/cdefs.h to be included
which defines __dead2 for the second time:
#if __GNUC_PREREQ__(2, 7)
#define __dead2 __attribute__((__noreturn__))
[...]
The only workaround is to do hacky post-processing on the generated code (or
perhaps use the textproc/flex port which does not patch the standard flex.skl
file).
The attached patch moves the __dead2 define after the "standard C headers" are
included and only attempts to define __dead2 if it is not already defined.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list