mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-12-02 16:42:14 +00:00
Mask ftepp math constants with a compiler flag
This commit is contained in:
parent
b20e2a9d34
commit
6a44b72db3
4 changed files with 48 additions and 3 deletions
20
doc/gmqcc.1
20
doc/gmqcc.1
|
@ -397,6 +397,26 @@ only the first component will be 0, while the other two will become
|
||||||
the first to of the global return value. This behavior is odd and
|
the first to of the global return value. This behavior is odd and
|
||||||
relying on it should be discouraged, and thus is not supported by
|
relying on it should be discouraged, and thus is not supported by
|
||||||
gmqcc.
|
gmqcc.
|
||||||
|
.It Fl f Ns Cm ftepp-mathdefs
|
||||||
|
Enable math constant definitions. This only works in combination
|
||||||
|
with \'\-fftepp' and is currently not included by '\-std=fteqcc'.
|
||||||
|
The following macros will be added:
|
||||||
|
.Bd -literal -offset indent
|
||||||
|
M_E
|
||||||
|
M_LOG2E
|
||||||
|
M_LOG10E
|
||||||
|
M_LN2
|
||||||
|
M_LN10
|
||||||
|
M_PI
|
||||||
|
M_PI_2
|
||||||
|
M_PI_4
|
||||||
|
M_1_PI
|
||||||
|
M_2_PI
|
||||||
|
M_2_SQRTPI
|
||||||
|
M_SQRT2
|
||||||
|
M_SQRT1_2
|
||||||
|
M_TAU
|
||||||
|
.Ed
|
||||||
.It Fl f Ns Cm relaxed-switch
|
.It Fl f Ns Cm relaxed-switch
|
||||||
Allow switch cases to use non constant variables.
|
Allow switch cases to use non constant variables.
|
||||||
.It Fl f Ns Cm short-logic
|
.It Fl f Ns Cm short-logic
|
||||||
|
|
2
ftepp.c
2
ftepp.c
|
@ -1900,9 +1900,11 @@ ftepp_t *ftepp_create()
|
||||||
ftepp_add_macro(ftepp, "__NULL__", "nil");
|
ftepp_add_macro(ftepp, "__NULL__", "nil");
|
||||||
|
|
||||||
/* add all the math constants if they can be */
|
/* add all the math constants if they can be */
|
||||||
|
if (OPTS_FLAG(FTEPP_MATHDEFS)) {
|
||||||
for (i = 0; i < GMQCC_ARRAY_COUNT(ftepp_math_constants); i++)
|
for (i = 0; i < GMQCC_ARRAY_COUNT(ftepp_math_constants); i++)
|
||||||
if (!ftepp_macro_find(ftepp, ftepp_math_constants[i][0]))
|
if (!ftepp_macro_find(ftepp, ftepp_math_constants[i][0]))
|
||||||
ftepp_add_macro(ftepp, ftepp_math_constants[i][0], ftepp_math_constants[i][1]);
|
ftepp_add_macro(ftepp, ftepp_math_constants[i][0], ftepp_math_constants[i][1]);
|
||||||
|
}
|
||||||
|
|
||||||
return ftepp;
|
return ftepp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,28 @@
|
||||||
FTEPP_PREDEFS = false
|
FTEPP_PREDEFS = false
|
||||||
|
|
||||||
|
|
||||||
|
#Enable math constant definitions. This only works in combination
|
||||||
|
#with '-fftepp' and is currently not included by '-std=fteqcc'.
|
||||||
|
#The following macros will be added:
|
||||||
|
#
|
||||||
|
# M_E
|
||||||
|
# M_LOG2E
|
||||||
|
# M_LOG10E
|
||||||
|
# M_LN2
|
||||||
|
# M_LN10
|
||||||
|
# M_PI
|
||||||
|
# M_PI_2
|
||||||
|
# M_PI_4
|
||||||
|
# M_1_PI
|
||||||
|
# M_2_PI
|
||||||
|
# M_2_SQRTPI
|
||||||
|
# M_SQRT2
|
||||||
|
# M_SQRT1_2
|
||||||
|
# M_TAU
|
||||||
|
|
||||||
|
FTEPP_MATHDEFS = false
|
||||||
|
|
||||||
|
|
||||||
#Allow switch cases to use non constant variables.
|
#Allow switch cases to use non constant variables.
|
||||||
|
|
||||||
RELAXED_SWITCH = true
|
RELAXED_SWITCH = true
|
||||||
|
|
1
opts.def
1
opts.def
|
@ -31,6 +31,7 @@
|
||||||
GMQCC_DEFINE_FLAG(ADJUST_VECTOR_FIELDS)
|
GMQCC_DEFINE_FLAG(ADJUST_VECTOR_FIELDS)
|
||||||
GMQCC_DEFINE_FLAG(FTEPP)
|
GMQCC_DEFINE_FLAG(FTEPP)
|
||||||
GMQCC_DEFINE_FLAG(FTEPP_PREDEFS)
|
GMQCC_DEFINE_FLAG(FTEPP_PREDEFS)
|
||||||
|
GMQCC_DEFINE_FLAG(FTEPP_MATHDEFS)
|
||||||
GMQCC_DEFINE_FLAG(RELAXED_SWITCH)
|
GMQCC_DEFINE_FLAG(RELAXED_SWITCH)
|
||||||
GMQCC_DEFINE_FLAG(SHORT_LOGIC)
|
GMQCC_DEFINE_FLAG(SHORT_LOGIC)
|
||||||
GMQCC_DEFINE_FLAG(PERL_LOGIC)
|
GMQCC_DEFINE_FLAG(PERL_LOGIC)
|
||||||
|
|
Loading…
Reference in a new issue