]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
Removed -fenhanced-diagnostics - it's now --correct, which makes sense since it doesn...
authorWolfgang Bumiller <blub@speed.at>
Sat, 12 Jan 2013 16:10:07 +0000 (17:10 +0100)
committerWolfgang Bumiller <blub@speed.at>
Sat, 12 Jan 2013 16:10:07 +0000 (17:10 +0100)
doc/gmqcc.1
gmqcc.h
gmqcc.ini.example
main.c
opts.c
opts.def
parser.c

index a67c1f5557a2a0b7571e75478753d958bf363b05..fe4909bbeeac5295a73b3c176227900c2416761e 100644 (file)
@@ -151,6 +151,10 @@ String containing the compiler version as printed by the --version
 parameter.
 .RE
 .TP
+.BR "--correct" ", " "--no-correct"
+When enabled, errors about undefined values try to suggest an existing
+value via spell checking.
+.TP
 .B "-dump"
 DEBUG OPTION. Print the code's intermediate representation before the
 optimization and finalization passes to stdout before generating the
diff --git a/gmqcc.h b/gmqcc.h
index 553197ab6b997c062db38abc328b424aaec1e7df..a6053a6d1cd60e5a21efb74534ed58183ddc1a6e 100644 (file)
--- a/gmqcc.h
+++ b/gmqcc.h
@@ -1149,6 +1149,7 @@ typedef struct {
     bool        pp_only;        /* -E            */
     size_t      max_array_size; /* --max-array=  */
     bool        add_info;       /* --add-info    */
+    bool        correction;     /* --correct     */
 
     uint32_t flags        [1 + (COUNT_FLAGS         / 32)];
     uint32_t warn         [1 + (COUNT_WARNINGS      / 32)];
index 5a6339a38374de7230987cb1eb3f2558780d6724..763b3932c175ba31cdceee7702eb2bf949ae4406 100644 (file)
     # variables with the name 'nil' to be declared.
     PREMISSIVE                   = false
 
-    # Enable enhanced diagnostic messages. i.e provides a "did you mean"
-    # <ident> when you accidently typo. Amongst others
-    ENHANCED_DIAGNOSTICS         = true
-
     # Allow vararg access from within QC of the form: ...(argnumber, type)
     VARIADIC_ARGS                = true
 
diff --git a/main.c b/main.c
index ff67262186a0c87c65c650585c2c05ea12020d33..2b055d2210f35bf59d556053f366e27c7c12e3d8 100644 (file)
--- a/main.c
+++ b/main.c
@@ -465,6 +465,14 @@ static bool options_parse(int argc, char **argv) {
                         opts.quiet = true;
                         break;
                     }
+                    else if (!strcmp(argv[0]+2, "correct")) {
+                        opts.correction = true;
+                        break;
+                    }
+                    else if (!strcmp(argv[0]+2, "no-correct")) {
+                        opts.correction = false;
+                        break;
+                    }
                     else if (!strcmp(argv[0]+2, "add-info")) {
                         opts.add_info = true;
                         break;
diff --git a/opts.c b/opts.c
index ef7b10e69c2145f9eaf2f3f874cdcd306a29093b..0c8d3f4c2de1bc7b561777e12fa35484b00441a6 100644 (file)
--- a/opts.c
+++ b/opts.c
@@ -27,7 +27,8 @@ opts_cmd_t   opts; /* command lien options */
 
 static void opts_setdefault() {
     memset(&opts, 0, sizeof(opts_cmd_t));
-    
+    opts.correction = true;
+
     /* warnings */
     opts_set(opts.warn,  WARN_UNUSED_VARIABLE,           true);
     opts_set(opts.warn,  WARN_USED_UNINITIALIZED,        true);
@@ -65,7 +66,6 @@ static void opts_setdefault() {
     opts_set(opts.flags, FTEPP_PREDEFS,                  false);
     opts_set(opts.flags, CORRECT_TERNARY,                true);
     opts_set(opts.flags, BAIL_ON_WERROR,                 true);
-    opts_set(opts.flags, ENHANCED_DIAGNOSTICS,           true);
 }
 
 void opts_backup_non_Wall() {
index 65c2d9e912ee72ff0b7225ea448f6f7f26272c89..2cd21cf79879a6c647f0402098609c9ac8ba0302 100644 (file)
--- a/opts.def
+++ b/opts.def
@@ -48,7 +48,6 @@
     GMQCC_DEFINE_FLAG(LOOP_LABELS)
     GMQCC_DEFINE_FLAG(UNTYPED_NIL)
     GMQCC_DEFINE_FLAG(PERMISSIVE)
-    GMQCC_DEFINE_FLAG(ENHANCED_DIAGNOSTICS)
     GMQCC_DEFINE_FLAG(VARIADIC_ARGS)
 #endif
 
index 53c7867bff857f4db8c60223b6320a9d9a8ddb52..3ed0f08eeeaaa61ff9cdc089f405c9307a059bbe 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -1795,7 +1795,7 @@ static ast_expression* parse_expression_leave(parser_t *parser, bool stopatcomma
                      * We should also consider adding correction tables for
                      * other things as well.
                      */
-                    if (OPTS_FLAG(ENHANCED_DIAGNOSTICS)) {
+                    if (opts.correction) {
                         correction_t corr;
                         correct_init(&corr);