static const ftepp_predef_t ftepp_predefs[] = {
{ "__LINE__", &ftepp_predef_line },
static const ftepp_predef_t ftepp_predefs[] = {
{ "__LINE__", &ftepp_predef_line },
/* singleton because we're allowed */
static GMQCC_INLINE char *(*ftepp_predef(const char *name))(ftepp_t *context) {
size_t i = ftepp_predef_index(name);
/* singleton because we're allowed */
static GMQCC_INLINE char *(*ftepp_predef(const char *name))(ftepp_t *context) {
size_t i = ftepp_predef_index(name);
if (ftepp_next(ftepp) != ']') {
ftepp_error(ftepp, "expected `]` in __VA_ARGS__ subscript");
if (ftepp_next(ftepp) != ']') {
ftepp_error(ftepp, "expected `]` in __VA_ARGS__ subscript");
/* user defined ones take precedence */
if (macro && mathconstant) {
ftepp_macro_delete(ftepp, ftepp_tokval(ftepp));
/* user defined ones take precedence */
if (macro && mathconstant) {
ftepp_macro_delete(ftepp, ftepp_tokval(ftepp));
/* need to leave the last token up */
static bool ftepp_macro_call_params(ftepp_t *ftepp, macroparam **out_params)
{
/* need to leave the last token up */
static bool ftepp_macro_call_params(ftepp_t *ftepp, macroparam **out_params)
{
if (!ftepp_skipallwhite(ftepp))
return false;
while (parens || ftepp->token != ',') {
if (!ftepp_skipallwhite(ftepp))
return false;
while (parens || ftepp->token != ',') {
else {
ppmacro *find = ftepp_macro_find(ftepp, out->value);
if (OPTS_FLAG(FTEPP_INDIRECT_EXPANSION) && find && !find->has_params)
else {
ppmacro *find = ftepp_macro_find(ftepp, out->value);
if (OPTS_FLAG(FTEPP_INDIRECT_EXPANSION) && find && !find->has_params)
- ftepp_macro_expand(ftepp, find, NULL, false);
+ ftepp_macro_expand(ftepp, find, nullptr, false);
static bool ftepp_preprocess(ftepp_t *ftepp);
static bool ftepp_macro_expand(ftepp_t *ftepp, ppmacro *macro, macroparam *params, bool resetline)
{
static bool ftepp_preprocess(ftepp_t *ftepp);
static bool ftepp_macro_expand(ftepp_t *ftepp, ppmacro *macro, macroparam *params, bool resetline)
{
if (!ftepp_preprocess(ftepp)) {
ftepp->in_macro = old_inmacro;
vec_free(ftepp->lex->open_string);
if (!ftepp_preprocess(ftepp)) {
ftepp->in_macro = old_inmacro;
vec_free(ftepp->lex->open_string);
- if (!ftepp_macro_expand(ftepp, macro, NULL, false))
+ if (!ftepp_macro_expand(ftepp, macro, nullptr, false))
ppmacro *macro = ftepp_macro_find(ftepp, ftepp_tokval(ftepp));
if (macro) {
char *backup = ftepp->output_string;
ppmacro *macro = ftepp_macro_find(ftepp, ftepp_tokval(ftepp));
if (macro) {
char *backup = ftepp->output_string;
- ftepp->output_string = NULL;
- if (ftepp_macro_expand(ftepp, macro, NULL, true)) {
+ ftepp->output_string = nullptr;
+ if (ftepp_macro_expand(ftepp, macro, nullptr, true)) {
parsename = util_strdup(ftepp->output_string);
vec_free(ftepp->output_string);
ftepp->output_string = backup;
parsename = util_strdup(ftepp->output_string);
vec_free(ftepp->output_string);
ftepp->output_string = backup;
memset(minor, 0, sizeof(minor));
memset(major, 0, sizeof(major));
/* set the right macro based on the selected standard */
memset(minor, 0, sizeof(minor));
memset(major, 0, sizeof(major));
/* set the right macro based on the selected standard */
util_snprintf(major, 32, "\"%d\"", GMQCC_VERSION_MAJOR);
util_snprintf(minor, 32, "\"%d\"", GMQCC_VERSION_MINOR);
} else if (OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_QCCX) {
util_snprintf(major, 32, "\"%d\"", GMQCC_VERSION_MAJOR);
util_snprintf(minor, 32, "\"%d\"", GMQCC_VERSION_MINOR);
} else if (OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_QCCX) {
util_snprintf(major, 32, "\"%d\"", GMQCC_VERSION_MAJOR);
util_snprintf(minor, 32, "\"%d\"", GMQCC_VERSION_MINOR);
} else if (OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_QCC) {
util_snprintf(major, 32, "\"%d\"", GMQCC_VERSION_MAJOR);
util_snprintf(minor, 32, "\"%d\"", GMQCC_VERSION_MINOR);
} else if (OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_QCC) {
lex_ctx_t ctx = { "__builtin__", 0, 0 };
ctx.file = source;
macro = ppmacro_new(ctx, name);
lex_ctx_t ctx = { "__builtin__", 0, 0 };
ctx.file = source;
macro = ppmacro_new(ctx, name);