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