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:
Yukihiro "Matz" Matsumoto
2021-01-22 18:38:53 +09:00
parent c5c156a6dd
commit dc51d89ac2
45 changed files with 1037 additions and 1049 deletions
+3 -1
View File
@@ -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
+14
View File
@@ -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
+16
View File
@@ -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 */