Change the available options to -dM and -dP. The former prints user macros,
the latter predefined macros. Can be combined by using -dMP or -dPM.
This commit is contained in:
@@ -63,9 +63,8 @@ Short options:
|
||||
-V Print the compiler version number
|
||||
-W [-+]warning[,...] Control warnings ('-' disables, '+' enables)
|
||||
-d Debug mode
|
||||
-dD Output user defined macros (needs -E)
|
||||
-dM Output all macro definitions (needs -E)
|
||||
-dN Output user defined macro names (needs -E)
|
||||
-dM Output all user macros (needs -E)
|
||||
-dP Output all predefined macros (needs -E)
|
||||
-g Add debug info to object file
|
||||
-h Help (this text)
|
||||
-j Default characters are signed
|
||||
@@ -202,24 +201,26 @@ Here is a description of all the command line options:
|
||||
Enables debug mode, for debugging the behavior of cc65.
|
||||
|
||||
|
||||
<label id="option-dD">
|
||||
<tag><tt>-dD</tt></tag>
|
||||
|
||||
Like <tt/<ref id="option-dM" name="-dM">/ but does not include the predefined
|
||||
macros.
|
||||
|
||||
|
||||
<label id="option-dM">
|
||||
<tag><tt>-dM</tt></tag>
|
||||
|
||||
When used with -E, will output <tt>#define</tt> directives for all the user
|
||||
macros defined during execution of the preprocessor. This does not include
|
||||
macros defined by the compiler.
|
||||
|
||||
Note: Can be combined with <tt/<ref id="option-dP" name="-dP">/ by using
|
||||
<tt/-dMP/.
|
||||
|
||||
|
||||
<label id="option-dP">
|
||||
<tag><tt>-dP</tt></tag>
|
||||
|
||||
When used with -E, will output <tt>#define</tt> directives for all the macros
|
||||
defined during execution of the preprocessor, including predefined macros.
|
||||
defined by the compiler itself. This does not include any user defined macros.
|
||||
|
||||
|
||||
<tag><tt>-dN</tt></tag>
|
||||
|
||||
Like <tt/<ref id="option-dD" name="-dD">/ but will only output the macro names,
|
||||
not their definitions.
|
||||
Note: Can be combined with <tt/<ref id="option-dM" name="-dM">/ by using
|
||||
<tt/-dMP/.
|
||||
|
||||
|
||||
<tag><tt>--debug-tables name</tt></tag>
|
||||
|
||||
@@ -497,15 +497,12 @@ void Compile (const char* FileName)
|
||||
{ /* Nothing */ }
|
||||
|
||||
/* Output macros if requested by the user */
|
||||
if (DumpAllMacrosFull) {
|
||||
OutputAllMacrosFull ();
|
||||
if (DumpPredefMacros) {
|
||||
OutputPredefMacros ();
|
||||
}
|
||||
if (DumpUserMacros) {
|
||||
OutputUserMacros ();
|
||||
}
|
||||
if (DumpUserMacrosFull) {
|
||||
OutputUserMacrosFull ();
|
||||
}
|
||||
|
||||
/* Close the output file */
|
||||
CloseOutputFile ();
|
||||
|
||||
@@ -47,9 +47,8 @@ unsigned char AddSource = 0; /* Add source lines as comments */
|
||||
unsigned char AllowNewComments = 0; /* Allow new style comments in C89 mode */
|
||||
unsigned char AutoCDecl = 0; /* Make functions default to __cdecl__ */
|
||||
unsigned char DebugInfo = 0; /* Add debug info to the obj */
|
||||
unsigned char DumpAllMacrosFull = 0; /* Output all macro defs */
|
||||
unsigned char DumpUserMacros = 0; /* Output user macro names */
|
||||
unsigned char DumpUserMacrosFull= 0; /* Output user macro defs */
|
||||
unsigned char DumpPredefMacros = 0; /* Output predefined macros */
|
||||
unsigned char DumpUserMacros = 0; /* Output user macros */
|
||||
unsigned char PreprocessOnly = 0; /* Just preprocess the input */
|
||||
unsigned char DebugOptOutput = 0; /* Output debug stuff */
|
||||
unsigned RegisterSpace = 6; /* Space available for register vars */
|
||||
|
||||
@@ -55,9 +55,8 @@ extern unsigned char AddSource; /* Add source lines as comments
|
||||
extern unsigned char AllowNewComments; /* Allow new style comments in C89 mode */
|
||||
extern unsigned char AutoCDecl; /* Make functions default to __cdecl__ */
|
||||
extern unsigned char DebugInfo; /* Add debug info to the obj */
|
||||
extern unsigned char DumpAllMacrosFull; /* Output all macro defs */
|
||||
extern unsigned char DumpUserMacros; /* Output user macro names */
|
||||
extern unsigned char DumpUserMacrosFull; /* Output user macro defs */
|
||||
extern unsigned char DumpPredefMacros; /* Output predefined macros */
|
||||
extern unsigned char DumpUserMacros; /* Output user macros */
|
||||
extern unsigned char PreprocessOnly; /* Just preprocess the input */
|
||||
extern unsigned char DebugOptOutput; /* Output debug stuff */
|
||||
extern unsigned RegisterSpace; /* Space available for register vars */
|
||||
|
||||
@@ -62,8 +62,8 @@ static Macro* MacroTab[MACRO_TAB_SIZE];
|
||||
static Macro* UndefinedMacrosListHead;
|
||||
|
||||
/* Some defines for better readability when calling OutputMacros() */
|
||||
#define ALL_MACROS 0
|
||||
#define USER_MACROS 1
|
||||
#define USER_MACROS 0
|
||||
#define PREDEF_MACROS 1
|
||||
#define NAME_ONLY 0
|
||||
#define FULL_DEFINITION 1
|
||||
|
||||
@@ -107,14 +107,17 @@ static void OutputMacro (const Macro* M, int Full)
|
||||
|
||||
|
||||
|
||||
static void OutputMacros (int UserOnly, int Full)
|
||||
/* Output macros to the output file depending on the flags given */
|
||||
static void OutputMacros (int Predefined, int Full)
|
||||
/* Output macros to the output file depending on the flags given. */
|
||||
{
|
||||
/* Note: The Full flag is currently not used by any callers but is left in
|
||||
** place for possible future changes.
|
||||
*/
|
||||
unsigned I;
|
||||
for (I = 0; I < MACRO_TAB_SIZE; ++I) {
|
||||
const Macro* M = MacroTab [I];
|
||||
while (M) {
|
||||
if (!UserOnly || !M->Predefined) {
|
||||
if ((Predefined != 0) == (M->Predefined != 0)) {
|
||||
OutputMacro (M, Full);
|
||||
}
|
||||
M = M->Next;
|
||||
@@ -416,23 +419,15 @@ void PrintMacroStats (FILE* F)
|
||||
|
||||
|
||||
|
||||
void OutputAllMacrosFull (void)
|
||||
/* Output all macros to the output file */
|
||||
void OutputPredefMacros (void)
|
||||
/* Output all predefined macros to the output file */
|
||||
{
|
||||
OutputMacros (ALL_MACROS, FULL_DEFINITION);
|
||||
OutputMacros (PREDEF_MACROS, FULL_DEFINITION);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void OutputUserMacros (void)
|
||||
/* Output the names of all user defined macros to the output file */
|
||||
{
|
||||
OutputMacros (USER_MACROS, NAME_ONLY);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void OutputUserMacrosFull (void)
|
||||
/* Output all user defined macros to the output file */
|
||||
{
|
||||
OutputMacros (USER_MACROS, FULL_DEFINITION);
|
||||
|
||||
@@ -133,13 +133,10 @@ int MacroCmp (const Macro* M1, const Macro* M2);
|
||||
void PrintMacroStats (FILE* F);
|
||||
/* Print macro statistics to the given text file. */
|
||||
|
||||
void OutputAllMacrosFull (void);
|
||||
/* Output all macros to the output file */
|
||||
void OutputPredefMacros (void);
|
||||
/* Output all predefined macros to the output file */
|
||||
|
||||
void OutputUserMacros (void);
|
||||
/* Output the names of all user defined macros to the output file */
|
||||
|
||||
void OutputUserMacrosFull (void);
|
||||
/* Output all user defined macros to the output file */
|
||||
|
||||
|
||||
|
||||
@@ -93,9 +93,8 @@ static void Usage (void)
|
||||
" -V\t\t\t\tPrint the compiler version number\n"
|
||||
" -W [-+]warning[,...]\t\tControl warnings ('-' disables, '+' enables)\n"
|
||||
" -d\t\t\t\tDebug mode\n"
|
||||
" -dD\t\t\t\tOutput user defined macros (needs -E)\n"
|
||||
" -dM\t\t\t\tOutput all macro definitions (needs -E)\n"
|
||||
" -dN\t\t\t\tOutput user defined macro names (needs -E)\n"
|
||||
" -dM\t\t\t\tOutput all user macros (needs -E)\n"
|
||||
" -dP\t\t\t\tOutput all predefined macros (needs -E)\n"
|
||||
" -g\t\t\t\tAdd debug info to object file\n"
|
||||
" -h\t\t\t\tHelp (this text)\n"
|
||||
" -j\t\t\t\tDefault characters are signed\n"
|
||||
@@ -1025,25 +1024,24 @@ int main (int argc, char* argv[])
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
switch (Arg[2]) {
|
||||
case '\0':
|
||||
OptDebug (Arg, 0);
|
||||
break;
|
||||
case 'D':
|
||||
DumpUserMacrosFull = 1;
|
||||
break;
|
||||
case 'M':
|
||||
DumpAllMacrosFull = 1;
|
||||
break;
|
||||
case 'N':
|
||||
DumpUserMacros = 1;
|
||||
break;
|
||||
default:
|
||||
UnknownOption (Arg);
|
||||
break;
|
||||
}
|
||||
if (Arg[2] && Arg[3]) {
|
||||
UnknownOption (Arg);
|
||||
P = Arg + 2;
|
||||
if (*P == '\0') {
|
||||
OptDebug (Arg, 0);
|
||||
} else {
|
||||
while (*P) {
|
||||
switch (*P) {
|
||||
case 'M':
|
||||
DumpUserMacros = 1;
|
||||
break;
|
||||
case 'P':
|
||||
DumpPredefMacros = 1;
|
||||
break;
|
||||
default:
|
||||
UnknownOption (Arg);
|
||||
break;
|
||||
}
|
||||
++P;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1157,10 +1155,8 @@ int main (int argc, char* argv[])
|
||||
}
|
||||
|
||||
/* The options to output macros can only be used with -E */
|
||||
if (DumpAllMacrosFull || DumpUserMacros || DumpUserMacrosFull) {
|
||||
if (!PreprocessOnly) {
|
||||
AbEnd ("Preprocessor macro output can only be used together with -E");
|
||||
}
|
||||
if ((DumpPredefMacros || DumpUserMacros) && !PreprocessOnly) {
|
||||
AbEnd ("Preprocessor macro output can only be used together with -E");
|
||||
}
|
||||
|
||||
/* Add the default include search paths. */
|
||||
|
||||
Reference in New Issue
Block a user