Commits

Iain Buclaw committed 951ff44

ASCII collate lang switches.

Comments (0)

Files changed (2)

 d_handle_option (size_t scode, const char *arg, int value)
 #endif
 {
-  enum opt_code code = (enum opt_code) scode;
-  int level;
+    enum opt_code code = (enum opt_code) scode;
+    int level;
 
-  switch (code)
-      {
-      case OPT_I:
-          global.params.imppath->push(xstrdup(arg)); // %% not sure if we can keep the arg or not
-          break;
-      case OPT_J:
-          global.params.fileImppath->push(xstrdup(arg));
-          break;
-      case OPT_fdeprecated:
-          global.params.useDeprecated = value;
-          break;
-      case OPT_fassert:
-          global.params.useAssert = value;
-          break;
-      case OPT_frelease:
-          global.params.useInvariants = ! value;
-          global.params.useIn = ! value;
-          global.params.useOut = ! value;
-          global.params.useAssert = ! value;
+    switch (code)
+    {
+        case OPT_fasm:
+            gen.useInlineAsm = value;
+            break;
+
+        case OPT_fassert:
+            global.params.useAssert = value;
+            break;
+
 #if V2
-          // release mode doesn't turn off bounds checking for safe functions.
-          global.params.useArrayBounds = ! value ? 2 : 1;
-          flag_bounds_check = ! value;
+        case OPT_fbounds_check:
+            global.params.noboundscheck = ! value;
+            break;
+#endif
+        case OPT_fbuiltin:
+            gen.useBuiltins = value;
+            break;
+
+        case OPT_fdebug:
+            global.params.debuglevel = value ? 1 : 0;
+            break;
+
+        case OPT_fdebug_:
+            if (ISDIGIT(arg[0]))
+            {
+                if (! parse_int(arg, & level))
+                    goto Lerror_d;
+                DebugCondition::setGlobalLevel(level);
+            }
+            else if (Lexer::isValidIdentifier(CONST_CAST(char*, arg)))
+                DebugCondition::addGlobalIdent(xstrdup(arg));
+            else
+            {
+              Lerror_d:
+                error("bad argument for -fdebug");
+            }
+            break;
+
+        case OPT_fdebug_c:
+            strcpy(lang_name, value ? "GNU C" : "GNU D");
+            break;
+
+        case OPT_fdeprecated:
+            global.params.useDeprecated = value;
+            break;
+
+        case OPT_fdeps_:
+            global.params.moduleDepsFile = xstrdup(arg);
+            if (!global.params.moduleDepsFile[0])
+                error("bad argument for -fdeps");
+            global.params.moduleDeps = new OutBuffer;
+            break;
+
+        case OPT_fdoc:
+            global.params.doDocComments = value;
+            break;
+
+        case OPT_fdoc_dir_:
+            global.params.doDocComments = 1;
+            global.params.docdir = xstrdup(arg);
+            break;
+
+        case OPT_fdoc_file_:
+            global.params.doDocComments = 1;
+            global.params.docname = xstrdup(arg);
+            break;
+
+        case OPT_fdoc_inc_:
+            global.params.ddocfiles->push(xstrdup(arg));
+            break;
+
+        case OPT_fdump_source:
+            global.params.dump_source = value;
+            break;
+
+        case OPT_fd_verbose:
+            global.params.verbose = 1;
+            break;
+
+        case OPT_fd_version_1:
+            global.params.Dversion = 1;
+            break;
+
+        case OPT_fd_vtls:
+            global.params.vtls = 1;
+            break;
+
+        case OPT_femit_templates:
+            gen.emitTemplates = value ? TEauto : TEnone;
+            break;
+
+        case OPT_femit_templates_:
+            if (! arg || ! *arg)
+                gen.emitTemplates = value ? TEauto : TEnone;
+            else if (! strcmp(arg, "normal"))
+                gen.emitTemplates = TEnormal;
+            else if (! strcmp(arg, "all"))
+                gen.emitTemplates = TEall;
+            else if (! strcmp(arg, "private"))
+                gen.emitTemplates = TEprivate;
+            else if (! strcmp(arg, "none"))
+                gen.emitTemplates = TEnone;
+            else if (! strcmp(arg, "auto"))
+                gen.emitTemplates = TEauto;
+            else
+                error("bad argument for -femit-templates");
+            break;
+
+        case OPT_fignore_unknown_pragmas:
+            global.params.ignoreUnsupportedPragmas = value;
+            break;
+
+        case OPT_fintfc:
+            global.params.doHdrGeneration = value;
+            break;
+
+        case OPT_fintfc_dir_:
+            global.params.doHdrGeneration = 1;
+            global.params.hdrdir = xstrdup(arg);
+            break;
+
+        case OPT_fintfc_file_:
+            global.params.doHdrGeneration = 1;
+            global.params.hdrname = xstrdup(arg);
+            break;
+
+        case OPT_fonly_:
+            fonly_arg = xstrdup(arg);
+            break;
+#if V2
+        case OPT_fproperty:
+            global.params.enforcePropertySyntax = 1;
+#endif
+        case OPT_frelease:
+            global.params.useInvariants = ! value;
+            global.params.useIn = ! value;
+            global.params.useOut = ! value;
+            global.params.useAssert = ! value;
+#if V2
+            // release mode doesn't turn off bounds checking for safe functions.
+            global.params.useArrayBounds = ! value ? 2 : 1;
+            flag_bounds_check = ! value;
 #else
-          flag_bounds_check = global.params.useArrayBounds = ! value;
+            flag_bounds_check = global.params.useArrayBounds = ! value;
 #endif
-          global.params.useSwitchError = ! value;
-          break;
-#if V2
-      case OPT_fbounds_check:
-          global.params.noboundscheck = ! value;
-          break;
-#endif
-      case OPT_funittest:
-          global.params.useUnitTests = value;
-          break;
-      case OPT_fversion_:
-          if (ISDIGIT(arg[0]))
-          {
-              if (! parse_int(arg, & level))
-                  goto Lerror_v;
-              VersionCondition::setGlobalLevel(level);
-          }
-          else if (Lexer::isValidIdentifier(CONST_CAST(char*, arg)))
-              VersionCondition::addGlobalIdent(xstrdup(arg));
-          else
-          {
-        Lerror_v:
-              error("bad argument for -fversion");
-          }
-          break;
-      case OPT_fdebug:
-          global.params.debuglevel = value ? 1 : 0;
-          break;
-      case OPT_fdebug_:
-          if (ISDIGIT(arg[0]))
-          {
-              if (! parse_int(arg, & level))
-                  goto Lerror_d;
-              DebugCondition::setGlobalLevel(level);
-          }
-          else if (Lexer::isValidIdentifier(CONST_CAST(char*, arg)))
-              DebugCondition::addGlobalIdent(xstrdup(arg));
-          else
-          {
-        Lerror_d:
-              error("bad argument for -fdebug");
-          }
-          break;
-      case OPT_fdebug_c:
-          strcpy(lang_name, value ? "GNU C" : "GNU D");
-          break;
-      case OPT_fdeps_:
-          global.params.moduleDepsFile = xstrdup(arg);
-          if (!global.params.moduleDepsFile[0])
-              error("bad argument for -fdeps");
-          global.params.moduleDeps = new OutBuffer;
-          break;
-      case OPT_fignore_unknown_pragmas:
-          global.params.ignoreUnsupportedPragmas = value;
-          break;
-#if V2
-      case OPT_fproperty:
-          global.params.enforcePropertySyntax = 1;
-#endif
-      case OPT_fintfc:
-          global.params.doHdrGeneration = value;
-          break;
-      case OPT_fintfc_dir_:
-          global.params.doHdrGeneration = 1;
-          global.params.hdrdir = xstrdup(arg);
-          break;
-      case OPT_fintfc_file_:
-          global.params.doHdrGeneration = 1;
-          global.params.hdrname = xstrdup(arg);
-          break;
-      case OPT_fdoc:
-          global.params.doDocComments = value;
-          break;
-      case OPT_fdoc_dir_:
-          global.params.doDocComments = 1;
-          global.params.docdir = xstrdup(arg);
-          break;
-      case OPT_fdoc_file_:
-          global.params.doDocComments = 1;
-          global.params.docname = xstrdup(arg);
-          break;
-      case OPT_fdoc_inc_:
-          global.params.ddocfiles->push(xstrdup(arg));
-          break;
-      case OPT_fd_verbose:
-          global.params.verbose = 1;
-          break;
-      case OPT_fd_vtls:
-          global.params.vtls = 1;
-          break;
-      case OPT_fd_version_1:
-          global.params.Dversion = 1;
-          break;
-      case OPT_femit_templates:
-          gen.emitTemplates = value ? TEauto : TEnone;
-          break;
-      case OPT_femit_templates_:
-          if (! arg || ! *arg)
-              gen.emitTemplates = value ? TEauto : TEnone;
-          else if (! strcmp(arg, "normal"))
-              gen.emitTemplates = TEnormal;
-          else if (! strcmp(arg, "all"))
-              gen.emitTemplates = TEall;
-          else if (! strcmp(arg, "private"))
-              gen.emitTemplates = TEprivate;
-          else if (! strcmp(arg, "none"))
-              gen.emitTemplates = TEnone;
-          else if (! strcmp(arg, "auto"))
-              gen.emitTemplates = TEauto;
-          else
-              error("bad argument for -femit-templates");
-          break;
-      case OPT_fonly_:
-          fonly_arg = xstrdup(arg);
-          break;
-      case OPT_iprefix:
-          iprefix = xstrdup(arg);
-          break;
-      case OPT_imultilib:
-          multilib_dir = xstrdup(arg);
-          break;
-      case OPT_nostdinc:
-          std_inc = false;
-          break;
-      case OPT_fdump_source:
-          global.params.dump_source = value;
-          break;
-      case OPT_fasm:
-          gen.useInlineAsm = value;
-          break;
-      case OPT_fbuiltin:
-          gen.useBuiltins = value;
-          break;
-      case OPT_Wall:
-          global.params.warnings = 2;
-          gen.warnSignCompare = value;
-          break;
-      case OPT_Werror:
-          global.params.warnings = 1;
-          gen.warnSignCompare = value;
-          break;
-      case OPT_Wsign_compare:
-          gen.warnSignCompare = value;
-          break;
-      case OPT_fXf_:
-          global.params.doXGeneration = 1;
-          global.params.xfilename = xstrdup(arg);
-          break;
-      default:
-          break;
-      }
-  return 1;
+            global.params.useSwitchError = ! value;
+            break;
+
+        case OPT_funittest:
+            global.params.useUnitTests = value;
+            break;
+
+        case OPT_fversion_:
+            if (ISDIGIT(arg[0]))
+            {
+                if (! parse_int(arg, & level))
+                    goto Lerror_v;
+                VersionCondition::setGlobalLevel(level);
+            }
+            else if (Lexer::isValidIdentifier(CONST_CAST(char*, arg)))
+                VersionCondition::addGlobalIdent(xstrdup(arg));
+            else
+            {
+              Lerror_v:
+                error("bad argument for -fversion");
+            }
+            break;
+
+        case OPT_fXf_:
+            global.params.doXGeneration = 1;
+            global.params.xfilename = xstrdup(arg);
+            break;
+
+        case OPT_imultilib:
+            multilib_dir = xstrdup(arg);
+            break;
+
+        case OPT_iprefix:
+            iprefix = xstrdup(arg);
+            break;
+
+        case OPT_I:
+            global.params.imppath->push(xstrdup(arg)); // %% not sure if we can keep the arg or not
+            break;
+
+        case OPT_J:
+            global.params.fileImppath->push(xstrdup(arg));
+            break;
+
+        case OPT_nostdinc:
+            std_inc = false;
+            break;
+
+        case OPT_Wall:
+            global.params.warnings = 2;
+            gen.warnSignCompare = value;
+            break;
+
+        case OPT_Werror:
+            global.params.warnings = 1;
+            gen.warnSignCompare = value;
+            break;
+
+        case OPT_Wsign_compare:
+            gen.warnSignCompare = value;
+            break;
+
+        default:
+            break;
+    }
+    return 1;
 }
 
 bool d_post_options(const char ** fn)
 ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 ; This is used in GCC 3.4+
-; %% TODO cleanup in ASCII collating order.
 
 Language
 D
 
-I
-D Joined Separate
--I <dir>	Add <dir> to the end of the main include path.
-
-J
-D Joined Separate
--J <dir>	Add <dir> to the end of the string import path.
-
-fdeprecated
+fasm
 D
-Allow use of deprecated features
+Recognize the \"asm\" keyword
 
 fassert
 D
 Generate runtime code for assert()'s
 
-frelease
-D
-Compile release version
-
 ; For D: defaults to on
 fbounds-check
 D
 Generate code to check bounds before indexing arrays
 
-funittest
+fbuiltin
 D
-Compile in unittest code
+Recognize built-in functions
 
-fversion=
-D Joined RejectNegative
--fversion=<level|ident> Compile in version code >= <level> or identified by <ident>
+fdebug
+D
+Compile in debug code
 
 fdebug=
 D Joined RejectNegative
 -fdebug,-fdebug=<level>,-fdebug=<ident> Compile in debug code, code <= level, or code identified by ident
 
-fdebug
-D
-Compile in debug code
-
 fdebug-c
 D
 With -g, generate C debug information for debugger compatibility
 
+fdeprecated
+D
+Allow use of deprecated features
+
 fdeps=
 D Joined RejectNegative
 -fdeps=<filename> Write module dependencies to filename
 
-fd-verbose
-D
-Print information about D language processing to stdout
-
-fd-vtls
-D
-List all variables going into thread local storage
-
-fd-version=1
-D RejectNegative
-Compile as D language version 1
-
-femit-templates=
-D Joined RejectNegative
--femit-templates=[normal|private|all|none|auto]	Control template emission
-
-femit-templates
-D
--femit-templates Emit templates code and data even if the linker cannot merge multiple copies
-
-nostdinc
-D
-Do not search standard system include directories
-
-fonly=
-D Joined RejectNegative
-Process all modules specified on the command line, but only generate code for the module specified by the argument.
-
-fignore-unknown-pragmas
-D
-Ignore unsupported pragmas
-
-fproperty
-D
-Enforce property syntax
-
-fintfc
-Generate D interface files
-
-fintfc-dir=
-D Joined RejectNegative
--fintfc-dir=<dir> Write D interface files to directory <dir>
-
-fintfc-file=
-D Joined RejectNegative
--fintfc-file=<filename> Write D interface file to <filename>
-
 fdoc
 D
 Generate documentation
 D Joined RejectNegative
 -fdoc-inc=<filename> Include a Ddoc macro file
 
-Wsign-compare
-D
-Warn about signed-unsigned comparisons
-
 fdump-source
 D RejectNegative
 Dump decoded UTF-8 text and source from HTML
 
-fasm
+fd-verbose
 D
-Recognize the \"asm\" keyword
+Print information about D language processing to stdout
 
-fbuiltin
+fd-version=1
+D RejectNegative
+Compile as D language version 1
+
+fd-vtls
 D
-Recognize built-in functions
+List all variables going into thread local storage
+
+femit-templates
+D
+-femit-templates Emit templates code and data even if the linker cannot merge multiple copies
+
+femit-templates=
+D Joined RejectNegative
+-femit-templates=[normal|private|all|none|auto]	Control template emission
+
+fignore-unknown-pragmas
+D
+Ignore unsupported pragmas
+
+fintfc
+Generate D interface files
+
+fintfc-dir=
+D Joined RejectNegative
+-fintfc-dir=<dir> Write D interface files to directory <dir>
+
+fintfc-file=
+D Joined RejectNegative
+-fintfc-file=<filename> Write D interface file to <filename>
+
+fonly=
+D Joined RejectNegative
+Process all modules specified on the command line, but only generate code for the module specified by the argument.
+
+fproperty
+D
+Enforce property syntax
+
+frelease
+D
+Compile release version
+
+funittest
+D
+Compile in unittest code
+
+fversion=
+D Joined RejectNegative
+-fversion=<level|ident> Compile in version code >= <level> or identified by <ident>
+
+fXf=
+D Joined RejectNegative
+-fXf=<filename> Write JSON file to <filename>
 
 imultilib
 D Joined Separate
 D Joined Separate
 -isystem <dir>	Add <dir> to the start of the system include path
 
+I
+D Joined Separate
+-I <dir>	Add <dir> to the end of the main include path.
+
+J
+D Joined Separate
+-J <dir>	Add <dir> to the end of the string import path.
+
+nostdinc
+D
+Do not search standard system include directories
+
 Wall
 D
 Enable most warning messages
 D
 Error out the compiler on warnings
 
-fXf=
-D Joined RejectNegative
--fXf=<filename> Write JSON file to <filename>
+Wsign-compare
+D
+Warn about signed-unsigned comparisons
+
 
 
 ; Everything below this line is used in 4.6+