Use posix wrappers in lexer
This commit is contained in:
parent
74f34747b1
commit
66bf23d2e7
3 changed files with 13 additions and 18 deletions
|
@ -98,8 +98,6 @@ grub_bin2h_SOURCES = gnulib/progname.c util/bin2h.c
|
||||||
# For the lexer.
|
# For the lexer.
|
||||||
grub_script.yy.c grub_script.yy.h: script/yylex.l
|
grub_script.yy.c grub_script.yy.h: script/yylex.l
|
||||||
$(LEX) -o grub_script.yy.c --header-file=grub_script.yy.h $(srcdir)/script/yylex.l
|
$(LEX) -o grub_script.yy.c --header-file=grub_script.yy.h $(srcdir)/script/yylex.l
|
||||||
sed -i 's/^#include.*\(<stdio\.h>\|<string\.h>\|<errno\.h>\|<stdlib\.h>\|<unistd\.h>\)//g' grub_script.yy.h
|
|
||||||
sed -i 's/^#include.*\(<stdio\.h>\|<string\.h>\|<errno\.h>\|<stdlib\.h>\|<unistd\.h>\)//g' grub_script.yy.c
|
|
||||||
DISTCLEANFILES += grub_script.yy.c grub_script.yy.h
|
DISTCLEANFILES += grub_script.yy.c grub_script.yy.h
|
||||||
|
|
||||||
# For grub-script-check.
|
# For grub-script-check.
|
||||||
|
@ -655,7 +653,7 @@ normal_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
# For sh.mod.
|
# For sh.mod.
|
||||||
sh_mod_SOURCES = script/main.c script/script.c script/execute.c \
|
sh_mod_SOURCES = script/main.c script/script.c script/execute.c \
|
||||||
script/function.c script/lexer.c grub_script.tab.c grub_script.yy.c
|
script/function.c script/lexer.c grub_script.tab.c grub_script.yy.c
|
||||||
sh_mod_CFLAGS = $(COMMON_CFLAGS)
|
sh_mod_CFLAGS = $(COMMON_CFLAGS) $(POSIX_CFLAGS)
|
||||||
sh_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
sh_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
ifneq (, $(FONT_SOURCE))
|
ifneq (, $(FONT_SOURCE))
|
||||||
|
|
|
@ -20,5 +20,10 @@
|
||||||
#define GRUB_POSIX_STDIO_H 1
|
#define GRUB_POSIX_STDIO_H 1
|
||||||
|
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
|
#include <grub/file.h>
|
||||||
|
|
||||||
|
typedef struct grub_file FILE;
|
||||||
|
|
||||||
|
#define EOF -1
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -68,31 +68,23 @@ static void copy_string (struct grub_parser_param *, const char *,
|
||||||
|
|
||||||
%top{
|
%top{
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
typedef size_t yy_size_t;
|
||||||
|
#define YY_TYPEDEF_YY_SIZE_T 1
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some flex hacks for -nostdinc; XXX We need to fix these when libc
|
* Some flex hacks for -nostdinc; XXX We need to fix these when libc
|
||||||
* support becomes availble in GRUB.
|
* support becomes availble in GRUB.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <grub/types.h>
|
#ifndef GRUB_UTIL
|
||||||
|
|
||||||
typedef grub_size_t size_t;
|
|
||||||
typedef grub_size_t yy_size_t;
|
|
||||||
#define YY_TYPEDEF_YY_SIZE_T 1
|
|
||||||
|
|
||||||
#define FILE void
|
|
||||||
#define stdin 0
|
#define stdin 0
|
||||||
#define stdout 0
|
#define stdout 0
|
||||||
#define EOF 0
|
|
||||||
|
|
||||||
#define errno grub_errno
|
|
||||||
#define EINVAL GRUB_ERR_BAD_NUMBER
|
|
||||||
#define ENOMEM GRUB_ERR_OUT_OF_MEMORY
|
|
||||||
|
|
||||||
#define strlen grub_strlen
|
|
||||||
#define memset grub_memset
|
|
||||||
|
|
||||||
#define fprintf(...) 0
|
#define fprintf(...) 0
|
||||||
#define exit(...)
|
#define exit(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
#pragma GCC diagnostic warning "-Wunused-variable"
|
#pragma GCC diagnostic warning "-Wunused-variable"
|
||||||
#pragma GCC diagnostic warning "-Wunused-function"
|
#pragma GCC diagnostic warning "-Wunused-function"
|
||||||
|
|
Loading…
Reference in a new issue