The -A and --ansi switches are gone, together with the __STRICT_ANSI__

predefined macro. Instead there is now a command line option --standard that
allows to set c89, c99 or cc65 as language standard. The compiler defines a
macro __CC65_STD__ that is one of __CC65_STD_C89__, __CC65_STD_C99__ or
__CC65_STD_CC65__ depending on the command line option. Default is cc65 (all
extensions) as before.


git-svn-id: svn://svn.cc65.org/cc65/trunk@3133 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2004-06-21 22:22:11 +00:00
parent d01687fd82
commit 13a2927e17
17 changed files with 396 additions and 185 deletions

View File

@@ -46,6 +46,7 @@
#include "asmlabel.h"
#include "asmstmt.h"
#include "codegen.h"
#include "compile.h"
#include "declare.h"
#include "error.h"
#include "expr.h"
@@ -55,8 +56,8 @@
#include "litpool.h"
#include "macrotab.h"
#include "pragma.h"
#include "standard.h"
#include "symtab.h"
#include "compile.h"
@@ -286,16 +287,17 @@ void Compile (const char* FileName)
/* Add macros that are always defined */
DefineNumericMacro ("__CC65__", VERSION);
/* Strict ANSI macro */
if (ANSI) {
DefineNumericMacro ("__STRICT_ANSI__", 1);
}
/* Language standard that is supported */
DefineNumericMacro ("__CC65_STD_C89__", STD_C89);
DefineNumericMacro ("__CC65_STD_C99__", STD_C99);
DefineNumericMacro ("__CC65_STD_CC65__", STD_CC65);
DefineNumericMacro ("__CC65_STD__", IS_Get (&Standard));
/* Optimization macros. Since no source code has been parsed for now, the
* IS_Get functions access the values in effect now, regardless of any
* changes using #pragma later.
*/
if (IS_Get (&Optimize)) {
if (IS_Get (&Optimize)) {
long CodeSize = IS_Get (&CodeSizeFactor);
DefineNumericMacro ("__OPT__", 1);
if (CodeSize > 100) {

View File

@@ -56,6 +56,7 @@
#include "litpool.h"
#include "pragma.h"
#include "scanner.h"
#include "standard.h"
#include "symtab.h"
#include "typeconv.h"
@@ -794,10 +795,11 @@ static void ParseAnsiParamList (FuncDesc* F)
/* Check if this is a function definition */
if (CurTok.Tok == TOK_LCURLY) {
/* Print an error if in strict ANSI mode and we have unnamed
* parameters.
/* Print an error if we have unnamed parameters and cc65 extensions
* are disabled.
*/
if (ANSI && (F->Flags & FD_UNNAMED_PARAMS) != 0) {
if (IS_Get (&Standard) != STD_CC65 &&
(F->Flags & FD_UNNAMED_PARAMS) != 0) {
Error ("Parameter name omitted");
}
}
@@ -1512,7 +1514,7 @@ static unsigned ParseInitInternal (type* T, int AllowFlexibleMembers)
return ParseStructInit (T, AllowFlexibleMembers);
case T_VOID:
if (!ANSI) {
if (IS_Get (&Standard) == STD_CC65) {
/* Special cc65 extension in non ANSI mode */
return ParseVoidInit ();
}
@@ -1530,8 +1532,10 @@ static unsigned ParseInitInternal (type* T, int AllowFlexibleMembers)
unsigned ParseInit (type* T)
/* Parse initialization of variables. Return the number of data bytes. */
{
/* Parse the initialization */
unsigned Size = ParseInitInternal (T, !ANSI);
/* Parse the initialization. Flexible array members can only be initialized
* in cc65 mode.
*/
unsigned Size = ParseInitInternal (T, IS_Get (&Standard) == STD_CC65);
/* The initialization may not generate code on global level, because code
* outside function scope will never get executed.

View File

@@ -49,6 +49,7 @@
/* Options */
extern unsigned char AddSource; /* Add source lines as comments */
extern unsigned char DebugInfo; /* Add debug info to the obj */
extern unsigned char CreateDep; /* Create a dependency file */

View File

@@ -63,6 +63,7 @@
#include "input.h"
#include "macrotab.h"
#include "scanner.h"
#include "standard.h"
#include "segments.h"
@@ -79,7 +80,6 @@ static void Usage (void)
fprintf (stderr,
"Usage: %s [options] file\n"
"Short options:\n"
" -A\t\t\tStrict ANSI mode\n"
" -Cl\t\t\tMake local variables static\n"
" -Dsym[=defn]\t\tDefine a symbol\n"
" -I dir\t\tSet an include directory search path\n"
@@ -102,7 +102,6 @@ static void Usage (void)
"\n"
"Long options:\n"
" --add-source\t\tInclude source as comment\n"
" --ansi\t\tStrict ANSI mode\n"
" --bss-name seg\tSet the name of the BSS segment\n"
" --check-stack\t\tGenerate stack overflow checks\n"
" --code-name seg\tSet the name of the CODE segment\n"
@@ -124,6 +123,7 @@ static void Usage (void)
" --register-vars\tEnable register variables\n"
" --rodata-name seg\tSet the name of the RODATA segment\n"
" --signed-chars\tDefault characters are signed\n"
" --standard std\tLanguage standard (c89, c99, cc65)\n"
" --static-locals\tMake local variables static\n"
" --target sys\t\tSet the target system\n"
" --verbose\t\tIncrease verbosity\n"
@@ -329,15 +329,6 @@ static void OptAddSource (const char* Opt attribute ((unused)),
static void OptAnsi (const char* Opt attribute ((unused)),
const char* Arg attribute ((unused)))
/* Compile in strict ANSI mode */
{
ANSI = 1;
}
static void OptBssName (const char* Opt attribute ((unused)), const char* Arg)
/* Handle the --bss-name option */
{
@@ -627,6 +618,22 @@ static void OptSignedChars (const char* Opt attribute ((unused)),
static void OptStandard (const char* Opt, const char* Arg)
/* Handle the --standard option */
{
/* Find the standard from the given name */
standard_t Std = FindStandard (Arg);
if (Std == STD_UNKNOWN) {
AbEnd ("Invalid argument for %s: `%s'", Opt, Arg);
} else if (IS_Get (&Standard) != STD_UNKNOWN) {
AbEnd ("Option %s given more than once", Opt);
} else {
IS_Set (&Standard, Std);
}
}
static void OptStaticLocals (const char* Opt attribute ((unused)),
const char* Arg attribute ((unused)))
/* Place local variables in static storage */
@@ -678,7 +685,6 @@ int main (int argc, char* argv[])
/* Program long options */
static const LongOpt OptTab[] = {
{ "--add-source", 0, OptAddSource },
{ "--ansi", 0, OptAnsi },
{ "--bss-name", 1, OptBssName },
{ "--check-stack", 0, OptCheckStack },
{ "--code-name", 1, OptCodeName },
@@ -700,6 +706,7 @@ int main (int argc, char* argv[])
{ "--register-vars", 0, OptRegisterVars },
{ "--rodata-name", 1, OptRodataName },
{ "--signed-chars", 0, OptSignedChars },
{ "--standard", 1, OptStandard },
{ "--static-locals", 0, OptStaticLocals },
{ "--target", 1, OptTarget },
{ "--verbose", 0, OptVerbose },
@@ -777,10 +784,6 @@ int main (int argc, char* argv[])
OptVerbose (Arg, 0);
break;
case 'A':
OptAnsi (Arg, 0);
break;
case 'C':
P = Arg + 2;
while (*P) {
@@ -873,6 +876,11 @@ int main (int argc, char* argv[])
SetMemoryModel (MMODEL_NEAR);
}
/* If no language standard was given, use the default one */
if (IS_Get (&Standard) == STD_UNKNOWN) {
IS_Set (&Standard, STD_DEFAULT);
}
/* Go! */
Compile (InputFile);

View File

@@ -79,6 +79,7 @@ OBJS = anonname.o \
scanstrbuf.o \
segments.o \
stackptr.o \
standard.o \
stdfunc.o \
stdnames.o \
stmt.o \

View File

@@ -114,6 +114,7 @@ OBJS = anonname.obj \
scanstrbuf.obj \
segments.obj \
stackptr.obj \
standard.obj \
stdfunc.obj \
stdnames.obj \
stmt.obj \

View File

@@ -23,9 +23,10 @@
#include "input.h"
#include "lineinfo.h"
#include "macrotab.h"
#include "scanner.h"
#include "util.h"
#include "preproc.h"
#include "scanner.h"
#include "standard.h"
#include "util.h"
@@ -445,7 +446,7 @@ static int MacroCall (Macro* M)
} else if (CurC == '/' && NextC == '*') {
*B++ = ' ';
OldStyleComment ();
} else if (ANSI == 0 && CurC == '/' && NextC == '/') {
} else if (IS_Get (&Standard) >= STD_C99 && CurC == '/' && NextC == '/') {
*B++ = ' ';
NewStyleComment ();
} else if (CurC == '\0') {
@@ -637,7 +638,7 @@ static int Pass1 (const char* From, char* To)
} else if (CurC == '/' && NextC == '*') {
KeepChar (' ');
OldStyleComment ();
} else if (ANSI == 0 && CurC == '/' && NextC == '/') {
} else if (IS_Get (&Standard) >= STD_C99 && CurC == '/' && NextC == '/') {
KeepChar (' ');
NewStyleComment ();
} else {
@@ -755,7 +756,7 @@ static int PushIf (int Skip, int Invert, int Cond)
static int DoIf (int Skip)
/* Process #if directive */
{
{
ExprDesc Expr;
char* S;
@@ -1047,9 +1048,8 @@ void Preprocess (void)
break;
case PP_LINE:
/* Not allowed in strict ANSI mode */
if (!Skip && ANSI) {
PPError ("Preprocessor directive expected");
/* Should do something in C99 at least, but we ignore it */
if (!Skip) {
ClearLine ();
}
break;

View File

@@ -6,7 +6,7 @@
/* */
/* */
/* */
/* (C) 1998-2003 Ullrich von Bassewitz */
/* (C) 1998-2004 Ullrich von Bassewitz */
/* R<>merstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
@@ -54,9 +54,10 @@
#include "input.h"
#include "litpool.h"
#include "preproc.h"
#include "scanner.h"
#include "standard.h"
#include "symtab.h"
#include "util.h"
#include "scanner.h"
@@ -72,63 +73,66 @@ Token NextTok; /* The next token */
/* Token types */
#define TT_C 0 /* ANSI C token */
#define TT_EXT 1 /* cc65 extension */
enum {
TT_C89 = 0x01 << STD_C89, /* Token valid in C89 */
TT_C99 = 0x01 << STD_C99, /* Token valid in C99 */
TT_CC65 = 0x01 << STD_CC65 /* Token valid in cc65 */
};
/* Token table */
static const struct Keyword {
char* Key; /* Keyword name */
unsigned char Tok; /* The token */
unsigned char Type; /* Token type */
unsigned char Std; /* Token supported in which standards? */
} Keywords [] = {
{ "_Pragma", TOK_PRAGMA, TT_C },
{ "__AX__", TOK_AX, TT_C },
{ "__A__", TOK_A, TT_C },
{ "__EAX__", TOK_EAX, TT_C },
{ "__X__", TOK_X, TT_C },
{ "__Y__", TOK_Y, TT_C },
{ "__asm__", TOK_ASM, TT_C },
{ "__attribute__", TOK_ATTRIBUTE, TT_C },
{ "__far__", TOK_FAR, TT_C },
{ "__fastcall__", TOK_FASTCALL, TT_C },
{ "__near__", TOK_NEAR, TT_C },
{ "asm", TOK_ASM, TT_EXT },
{ "auto", TOK_AUTO, TT_C },
{ "break", TOK_BREAK, TT_C },
{ "case", TOK_CASE, TT_C },
{ "char", TOK_CHAR, TT_C },
{ "const", TOK_CONST, TT_C },
{ "continue", TOK_CONTINUE, TT_C },
{ "default", TOK_DEFAULT, TT_C },
{ "do", TOK_DO, TT_C },
{ "double", TOK_DOUBLE, TT_C },
{ "else", TOK_ELSE, TT_C },
{ "enum", TOK_ENUM, TT_C },
{ "extern", TOK_EXTERN, TT_C },
{ "far", TOK_FAR, TT_EXT },
{ "fastcall", TOK_FASTCALL, TT_EXT },
{ "float", TOK_FLOAT, TT_C },
{ "for", TOK_FOR, TT_C },
{ "goto", TOK_GOTO, TT_C },
{ "if", TOK_IF, TT_C },
{ "int", TOK_INT, TT_C },
{ "long", TOK_LONG, TT_C },
{ "near", TOK_NEAR, TT_EXT },
{ "register", TOK_REGISTER, TT_C },
{ "restrict", TOK_RESTRICT, TT_C },
{ "return", TOK_RETURN, TT_C },
{ "short", TOK_SHORT, TT_C },
{ "signed", TOK_SIGNED, TT_C },
{ "sizeof", TOK_SIZEOF, TT_C },
{ "static", TOK_STATIC, TT_C },
{ "struct", TOK_STRUCT, TT_C },
{ "switch", TOK_SWITCH, TT_C },
{ "typedef", TOK_TYPEDEF, TT_C },
{ "union", TOK_UNION, TT_C },
{ "unsigned", TOK_UNSIGNED, TT_C },
{ "void", TOK_VOID, TT_C },
{ "volatile", TOK_VOLATILE, TT_C },
{ "while", TOK_WHILE, TT_C },
{ "_Pragma", TOK_PRAGMA, TT_C99 | TT_CC65 },
{ "__AX__", TOK_AX, TT_C89 | TT_C99 | TT_CC65 },
{ "__A__", TOK_A, TT_C89 | TT_C99 | TT_CC65 },
{ "__EAX__", TOK_EAX, TT_C89 | TT_C99 | TT_CC65 },
{ "__X__", TOK_X, TT_C89 | TT_C99 | TT_CC65 },
{ "__Y__", TOK_Y, TT_C89 | TT_C99 | TT_CC65 },
{ "__asm__", TOK_ASM, TT_C89 | TT_C99 | TT_CC65 },
{ "__attribute__", TOK_ATTRIBUTE, TT_C89 | TT_C99 | TT_CC65 },
{ "__far__", TOK_FAR, TT_C89 | TT_C99 | TT_CC65 },
{ "__fastcall__", TOK_FASTCALL, TT_C89 | TT_C99 | TT_CC65 },
{ "__near__", TOK_NEAR, TT_C89 | TT_C99 | TT_CC65 },
{ "asm", TOK_ASM, TT_CC65 },
{ "auto", TOK_AUTO, TT_C89 | TT_C99 | TT_CC65 },
{ "break", TOK_BREAK, TT_C89 | TT_C99 | TT_CC65 },
{ "case", TOK_CASE, TT_C89 | TT_C99 | TT_CC65 },
{ "char", TOK_CHAR, TT_C89 | TT_C99 | TT_CC65 },
{ "const", TOK_CONST, TT_C89 | TT_C99 | TT_CC65 },
{ "continue", TOK_CONTINUE, TT_C89 | TT_C99 | TT_CC65 },
{ "default", TOK_DEFAULT, TT_C89 | TT_C99 | TT_CC65 },
{ "do", TOK_DO, TT_C89 | TT_C99 | TT_CC65 },
{ "double", TOK_DOUBLE, TT_C89 | TT_C99 | TT_CC65 },
{ "else", TOK_ELSE, TT_C89 | TT_C99 | TT_CC65 },
{ "enum", TOK_ENUM, TT_C89 | TT_C99 | TT_CC65 },
{ "extern", TOK_EXTERN, TT_C89 | TT_C99 | TT_CC65 },
{ "far", TOK_FAR, TT_CC65 },
{ "fastcall", TOK_FASTCALL, TT_CC65 },
{ "float", TOK_FLOAT, TT_C89 | TT_C99 | TT_CC65 },
{ "for", TOK_FOR, TT_C89 | TT_C99 | TT_CC65 },
{ "goto", TOK_GOTO, TT_C89 | TT_C99 | TT_CC65 },
{ "if", TOK_IF, TT_C89 | TT_C99 | TT_CC65 },
{ "int", TOK_INT, TT_C89 | TT_C99 | TT_CC65 },
{ "long", TOK_LONG, TT_C89 | TT_C99 | TT_CC65 },
{ "near", TOK_NEAR, TT_CC65 },
{ "register", TOK_REGISTER, TT_C89 | TT_C99 | TT_CC65 },
{ "restrict", TOK_RESTRICT, TT_C99 | TT_CC65 },
{ "return", TOK_RETURN, TT_C89 | TT_C99 | TT_CC65 },
{ "short", TOK_SHORT, TT_C89 | TT_C99 | TT_CC65 },
{ "signed", TOK_SIGNED, TT_C89 | TT_C99 | TT_CC65 },
{ "sizeof", TOK_SIZEOF, TT_C89 | TT_C99 | TT_CC65 },
{ "static", TOK_STATIC, TT_C89 | TT_C99 | TT_CC65 },
{ "struct", TOK_STRUCT, TT_C89 | TT_C99 | TT_CC65 },
{ "switch", TOK_SWITCH, TT_C89 | TT_C99 | TT_CC65 },
{ "typedef", TOK_TYPEDEF, TT_C89 | TT_C99 | TT_CC65 },
{ "union", TOK_UNION, TT_C89 | TT_C99 | TT_CC65 },
{ "unsigned", TOK_UNSIGNED, TT_C89 | TT_C99 | TT_CC65 },
{ "void", TOK_VOID, TT_C89 | TT_C99 | TT_CC65 },
{ "volatile", TOK_VOLATILE, TT_C89 | TT_C99 | TT_CC65 },
{ "while", TOK_WHILE, TT_C89 | TT_C99 | TT_CC65 },
};
#define KEY_COUNT (sizeof (Keywords) / sizeof (Keywords [0]))
@@ -143,7 +147,7 @@ static const struct Keyword {
/*****************************************************************************/
/* code */
/* code */
/*****************************************************************************/
@@ -156,14 +160,14 @@ static int CmpKey (const void* Key, const void* Elem)
static int FindKey (const char* Key)
static token_t FindKey (const char* Key)
/* Find a keyword and return the token. Return IDENT if the token is not a
* keyword.
*/
{
struct Keyword* K;
K = bsearch (Key, Keywords, KEY_COUNT, sizeof (Keywords [0]), CmpKey);
if (K && (K->Type != TT_EXT || ANSI == 0)) {
if (K && (K->Std & (0x01 << IS_Get (&Standard))) != 0) {
return K->Tok;
} else {
return TOK_IDENT;
@@ -262,7 +266,7 @@ static int ParseChar (void)
C = '\b';
break;
case 'f':
C = '\f';
C = '\f';
break;
case 'r':
C = '\r';
@@ -315,7 +319,7 @@ static int ParseChar (void)
}
break;
default:
Error ("Illegal character constant");
Error ("Illegal character constant");
C = ' ';
/* Try to do error recovery, otherwise the compiler will spit
* out thousands of errors in this place and abort.
@@ -446,11 +450,12 @@ static void NumericConst (void)
SB_Terminate (&S);
/* The following character tells us if we have an integer or floating
* point constant.
* point constant. Note: Hexadecimal floating point constants aren't
* supported in C89.
*/
IsFloat = (CurC == '.' ||
(Base == 10 && toupper (CurC) == 'E') ||
(Base == 16 && toupper (CurC) == 'P'));
(Base == 16 && toupper (CurC) == 'P' && IS_Get (&Standard) >= STD_C99));
/* If we don't have a floating point type, an octal prefix results in an
* octal base.
@@ -702,18 +707,18 @@ void NextToken (void)
return;
}
/* No reserved word, check for special symbols */
if (token [0] == '_') {
if (token[0] == '_' && token[1] == '_') {
/* Special symbols */
if (strcmp (token, "__FILE__") == 0) {
if (strcmp (token+2, "FILE__") == 0) {
NextTok.IVal = AddLiteral (GetCurrentFile());
NextTok.Tok = TOK_SCONST;
return;
} else if (strcmp (token, "__LINE__") == 0) {
} else if (strcmp (token+2, "LINE__") == 0) {
NextTok.Tok = TOK_ICONST;
NextTok.IVal = GetCurrentLine();
NextTok.Type = type_int;
return;
} else if (strcmp (token, "__func__") == 0) {
} else if (strcmp (token+2, "func__") == 0) {
/* __func__ is only defined in functions */
if (CurrentFunc) {
NextTok.IVal = AddLiteral (F_GetFuncName (CurrentFunc));

84
src/cc65/standard.c Normal file
View File

@@ -0,0 +1,84 @@
/*****************************************************************************/
/* */
/* standard.c */
/* */
/* Language standard definitions */
/* */
/* */
/* */
/* (C) 2004 Ullrich von Bassewitz */
/* R<>merstra<72>e 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
/* warranty. In no event will the authors be held liable for any damages */
/* arising from the use of this software. */
/* */
/* Permission is granted to anyone to use this software for any purpose, */
/* including commercial applications, and to alter it and redistribute it */
/* freely, subject to the following restrictions: */
/* */
/* 1. The origin of this software must not be misrepresented; you must not */
/* claim that you wrote the original software. If you use this software */
/* in a product, an acknowledgment in the product documentation would be */
/* appreciated but is not required. */
/* 2. Altered source versions must be plainly marked as such, and must not */
/* be misrepresented as being the original software. */
/* 3. This notice may not be removed or altered from any source */
/* distribution. */
/* */
/*****************************************************************************/
#include <string.h>
/* cc65 */
#include "standard.h"
/*****************************************************************************/
/* Data */
/*****************************************************************************/
/* Current language standard, will be set to STD_DEFAULT on startup */
IntStack Standard = INTSTACK(STD_UNKNOWN);
/* Table mapping names to standards, sorted by standard. */
static const char* StdNames[STD_COUNT] = {
"c89", "c99", "cc65"
};
/*****************************************************************************/
/* Code */
/*****************************************************************************/
standard_t FindStandard (const char* Name)
/* Find a standard by name. Returns one of the constants defined above.
* STD_UNKNOWN is returned if Name doesn't match a standard.
*/
{
unsigned I;
/* Check for a standard string */
for (I = 0; I < STD_COUNT; ++I) {
if (strcmp (StdNames [I], Name) == 0) {
return (standard_t)I;
}
}
/* Not found */
return STD_UNKNOWN;
}

88
src/cc65/standard.h Normal file
View File

@@ -0,0 +1,88 @@
/*****************************************************************************/
/* */
/* standard.h */
/* */
/* Language standard definitions */
/* */
/* */
/* */
/* (C) 2004 Ullrich von Bassewitz */
/* R<>merstra<72>e 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
/* warranty. In no event will the authors be held liable for any damages */
/* arising from the use of this software. */
/* */
/* Permission is granted to anyone to use this software for any purpose, */
/* including commercial applications, and to alter it and redistribute it */
/* freely, subject to the following restrictions: */
/* */
/* 1. The origin of this software must not be misrepresented; you must not */
/* claim that you wrote the original software. If you use this software */
/* in a product, an acknowledgment in the product documentation would be */
/* appreciated but is not required. */
/* 2. Altered source versions must be plainly marked as such, and must not */
/* be misrepresented as being the original software. */
/* 3. This notice may not be removed or altered from any source */
/* distribution. */
/* */
/*****************************************************************************/
#ifndef STANDARD_H
#define STANDARD_H
/* common */
#include "intstack.h"
/*****************************************************************************/
/* Data */
/*****************************************************************************/
/* Supported standards. */
typedef enum standard_t {
STD_UNKNOWN = -1,
STD_C89,
STD_C99,
STD_CC65,
/* Special constants */
STD_COUNT, /* Number of supported standards */
STD_DEFAULT = STD_CC65 /* Default standard if none given */
} standard_t;
/* Current language standard */
extern IntStack Standard; /* Language standard */
/*****************************************************************************/
/* Code */
/*****************************************************************************/
standard_t FindStandard (const char* Name);
/* Find a standard by name. Returns one of the constants defined above.
* STD_UNKNOWN is returned if Name doesn't match a standard.
*/
/* End of standard.h */
#endif

View File

@@ -603,7 +603,6 @@ static void Usage (void)
" -t sys\t\tSet the target system\n"
" -v\t\t\tVerbose mode\n"
" -vm\t\t\tVerbose map file\n"
" -A\t\t\tStrict ANSI mode\n"
" -C name\t\tUse linker config file\n"
" -Cl\t\t\tMake local variables static\n"
" -D sym[=defn]\t\tDefine a preprocessor symbol\n"
@@ -621,7 +620,6 @@ static void Usage (void)
"\n"
"Long options:\n"
" --add-source\t\tInclude source as comment\n"
" --ansi\t\tStrict ANSI mode\n"
" --asm-define sym[=v]\tDefine an assembler symbol\n"
" --asm-include-dir dir\tSet an assembler include directory\n"
" --bss-label name\tDefine and export a BSS segment label\n"
@@ -658,6 +656,7 @@ static void Usage (void)
" --register-vars\tEnable register variables\n"
" --rodata-name seg\tSet the name of the RODATA segment\n"
" --signed-chars\tDefault characters are signed\n"
" --standard std\tLanguage standard (c89, c99, cc65)\n"
" --start-addr addr\tSet the default start address\n"
" --static-locals\tMake local variables static\n"
" --target sys\t\tSet the target system\n"
@@ -679,15 +678,6 @@ static void OptAddSource (const char* Opt attribute ((unused)),
static void OptAnsi (const char* Opt attribute ((unused)),
const char* Arg attribute ((unused)))
/* Strict ANSI mode (compiler) */
{
CmdAddArg (&CC65, "-A");
}
static void OptAsmDefine (const char* Opt attribute ((unused)), const char* Arg)
/* Define an assembler symbol (assembler) */
{
@@ -1017,6 +1007,14 @@ static void OptSignedChars (const char* Opt attribute ((unused)),
static void OptStandard (const char* Opt attribute ((unused)), const char* Arg)
/* Set the language standard */
{
CmdAddArg2 (&CC65, "--standard", Arg);
}
static void OptStartAddr (const char* Opt attribute ((unused)), const char* Arg)
/* Set the default start address */
{
@@ -1092,7 +1090,6 @@ int main (int argc, char* argv [])
/* Program long options */
static const LongOpt OptTab[] = {
{ "--add-source", 0, OptAddSource },
{ "--ansi", 0, OptAnsi },
{ "--asm-define", 1, OptAsmDefine },
{ "--asm-include-dir", 1, OptAsmIncludeDir },
{ "--bss-label", 1, OptBssLabel },
@@ -1129,6 +1126,7 @@ int main (int argc, char* argv [])
{ "--register-vars", 0, OptRegisterVars },
{ "--rodata-name", 1, OptRodataName },
{ "--signed-chars", 0, OptSignedChars },
{ "--standard", 1, OptStandard },
{ "--start-addr", 1, OptStartAddr },
{ "--static-locals", 0, OptStaticLocals },
{ "--target", 1, OptTarget },
@@ -1169,11 +1167,6 @@ int main (int argc, char* argv [])
LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0]));
break;
case 'A':
/* Strict ANSI mode (compiler) */
OptAnsi (Arg, 0);
break;
case 'C':
if (Arg[2] == 'l' && Arg[3] == '\0') {
/* Make local variables static */