From 1207275a1e40eca352bfe5f59de4330bdc595ed1 Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Mon, 15 Oct 2018 21:11:46 +0200 Subject: [PATCH] Make --prenodef work more sensibly, remove caveat --prenodef was causing the preprocessor-specific options (like -std=c99 for gcpp or -V199901L for mcpp) to be omitted. That makes no sense; '-p ext' should be used when custom options are desired (also modify the text that mentions it to make that clearer). Only the macros should be omitted. The comment that warned about side effects with the order of --prenodef with respect to -p no longer applies, so remove it. --- main.py | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/main.py b/main.py index d0c8248..5733dec 100755 --- a/main.py +++ b/main.py @@ -225,14 +225,11 @@ Options marked with * are used to define the preprocessor macros __AGENTID__, __AGENTKEY__, __AGENTIDRAW__, __AGENTNAME__, __ASSETID__ and __SHORTFILE__, and have no effect if --prenodef is specified. -Using --prenodef before -p causes no macros whatsoever to be defined. If used -after -p, the type casting macros string(...), key(...), etc. will be defined. - If filename is a dash (-) then standard input is used. Use: {progname} -O help for help on the optimizer control options. Preprocessor modes: - ext Invoke preprocessor + ext Invoke a preprocessor with no default parameters mcpp Invoke mcpp as preprocessor, setting default parameters pertinent to it. Implies --precmd=mcpp gcpp Invoke GNU cpp as preprocessor, setting default parameters @@ -583,19 +580,19 @@ def main(argv): # Build preprocessor command line preproc_cmdline = [preproc_command] + preproc_user_args + if preproc == 'gcpp': + preproc_cmdline += [ + '-undef', '-x', 'c', '-std=c99', '-nostdinc', + '-trigraphs', '-dN', '-fno-extended-identifiers', + ] + + elif preproc == 'mcpp': + preproc_cmdline += [ + '-e', 'UTF-8', '-I-', '-N', '-3', '-j', + '-V199901L', + ] + if predefines: - if preproc == 'gcpp': - preproc_cmdline += [ - '-undef', '-x', 'c', '-std=c99', '-nostdinc', - '-trigraphs', '-dN', '-fno-extended-identifiers', - ] - - elif preproc == 'mcpp': - preproc_cmdline += [ - '-e', 'UTF-8', '-I-', '-N', '-3', '-j', - '-V199901L', - ] - preproc_cmdline += [ '-Dinteger(...)=((integer)(__VA_ARGS__))', '-Dfloat(...)=((float)(__VA_ARGS__))',