mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Minimize the changes in #5277
Instead of including `mruby/presym.h` everywhere, we provided the fallback `mruby/presym.inc` under `include/mruby` directory, and specify `-I<build-dir>/include` before `-I<top-dir>/include` in `presym.rake`. So even when someone drops `-I<build-dir>/include` in compiler options, it just compiles without failure.
This commit is contained in:
@@ -9,7 +9,9 @@
|
||||
|
||||
#if defined(MRB_NO_PRESYM)
|
||||
# include <mruby/presym/disable.h>
|
||||
#elif !defined(MRB_PRESYM_SCANNING)
|
||||
#elif defined(MRB_PRESYM_SCANNING)
|
||||
# include <mruby/presym/scanning.h>
|
||||
#else
|
||||
# include <mruby/presym/enable.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
** @file mruby/presym.inc - Fallback file for Preallocated Symbols
|
||||
**
|
||||
** See Copyright Notice in mruby.h
|
||||
*/
|
||||
|
||||
/*
|
||||
* Reading this file means you failed to specify `-I<build-dir>/include`
|
||||
* in the configuration. I will not use `PRESYM*` macros for compilation.
|
||||
*/
|
||||
|
||||
# error "mruby/presym.h"
|
||||
1 1 + + d
|
||||
#define MRB_NO_PRESYM
|
||||
@@ -8,6 +8,20 @@
|
||||
#define MRUBY_PRESYM_ENABLE_H
|
||||
|
||||
#undef MRB_PRESYM_MAX
|
||||
#define MRB_PRESYM_NAMED(lit, num, type, name)
|
||||
#define MRB_PRESYM_UNNAMED(lit, num)
|
||||
/* test for proper -I `<build-dir>/include` */
|
||||
/* fallback `presym.inc` defines `MRB_NO_PRESYM` */
|
||||
# include <mruby/presym.inc>
|
||||
|
||||
#undef MRB_PRESYM_MAX
|
||||
#undef MRB_PRESYM_NAMED
|
||||
#undef MRB_PRESYM_UNNAMED
|
||||
|
||||
#if defined(MRB_NO_PRESYM)
|
||||
# include <mruby/presym/disable.h>
|
||||
#else
|
||||
|
||||
#define MRB_PRESYM_NAMED(lit, num, type, name) MRB_##type##__##name = (num),
|
||||
#define MRB_PRESYM_UNNAMED(lit, num)
|
||||
|
||||
@@ -38,4 +52,6 @@ enum mruby_presym {
|
||||
static const mrb_sym name[] = {__VA_ARGS__}; \
|
||||
static void init_##name(mrb_state *mrb) {}
|
||||
|
||||
#endif /* !MRUBY_NO_PRESYM */
|
||||
|
||||
#endif /* MRUBY_PRESYM_ENABLE_H */
|
||||
|
||||
Reference in New Issue
Block a user