Allow Gen version decimals.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Mon, 22 Oct 2012 20:13:51 +0000 (16:13 -0400)
committerDamien Lespiau <damien.lespiau@intel.com>
Mon, 4 Mar 2013 15:54:35 +0000 (15:54 +0000)
This is preparatory work for Haswell (Gen 7.5).

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
assembler/src/main.c

index 82e395c..ef2afc4 100644 (file)
@@ -287,8 +287,22 @@ int main(int argc, char **argv)
 
                        break;
 
-               case 'g':
-                       gen_level = strtol(optarg, NULL, 0) * 10;
+               case 'g': {
+                       char *dec_ptr, *end_ptr;
+                       unsigned long decimal;
+
+                       gen_level = strtol(optarg, &dec_ptr, 10) * 10;
+
+                       if (*dec_ptr == '.') {
+                               decimal = strtoul(++dec_ptr, &end_ptr, 10);
+                               if (end_ptr != dec_ptr && *end_ptr == '\0') {
+                                       if (decimal > 10) {
+                                               fprintf(stderr, "Invalid Gen X decimal version\n");
+                                               exit(1);
+                                       }
+                                       gen_level += decimal;
+                               }
+                       }
 
                        if (gen_level < 40 || gen_level > 70) {
                                usage();
@@ -296,6 +310,7 @@ int main(int argc, char **argv)
                        }
 
                        break;
+               }
 
                case 'a':
                        advanced_flag = 1;