Print this page
5196 The cw wrapper restricts gcc to -O2

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/cw/cw.c
          +++ new/usr/src/tools/cw/cw.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
       23 + * Copyright 2014 Gary Mills
       24 + *
  23   25   * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  24   26   * Use is subject to license terms.
  25   27   */
  26   28  
  27   29  /*
  28   30   * Wrapper for the GNU C compiler to make it accept the Sun C compiler
  29   31   * arguments where possible.
  30   32   *
  31   33   * Since the translation is inexact, this is something of a work-in-progress.
  32   34   *
  33   35   */
  34   36  
  35   37  /* If you modify this file, you must increment CW_VERSION */
  36      -#define CW_VERSION      "1.29"
       38 +#define CW_VERSION      "1.30"
  37   39  
  38   40  /*
  39   41   * -#           Verbose mode
  40   42   * -###         Show compiler commands built by driver, no compilation
  41   43   * -A<name[(tokens)]>   Preprocessor predicate assertion
  42   44   * -B<[static|dynamic]> Specify dynamic or static binding
  43   45   * -C           Prevent preprocessor from removing comments
  44   46   * -c           Compile only - produce .o files, suppress linking
  45   47   * -cg92        Alias for -xtarget=ss1000
  46   48   * -D<name[=token]>     Associate name with token as if by #define
↓ open down ↓ 480 lines elided ↑ open up ↑
 527  529                  return;
 528  530  
 529  531          /*
 530  532           * Enable as many warnings as exist, then disable those that we never
 531  533           * ever want.
 532  534           */
 533  535          newae(h, "-Wall");
 534  536          newae(h, "-Wextra");
 535  537  }
 536  538  
 537      -static void
 538      -optim_disable(struct aelist *h, int level)
 539      -{
 540      -        if (level >= 2) {
 541      -                newae(h, "-fno-strict-aliasing");
 542      -                newae(h, "-fno-unit-at-a-time");
 543      -                newae(h, "-fno-optimize-sibling-calls");
 544      -        }
 545      -}
 546      -
 547  539  /* ARGSUSED */
 548  540  static void
 549  541  Xamode(struct aelist *h)
 550  542  {
 551  543  }
 552  544  
 553  545  static void
 554  546  Xcmode(struct aelist *h)
 555  547  {
 556  548          static int xconce;
↓ open down ↓ 741 lines elided ↑ open up ↑
1298 1290  
1299 1291                                          if (len != 4 || !isdigit(c))
1300 1292                                                  error(arg);
1301 1293  
1302 1294                                          if ((s = malloc(len)) == NULL)
1303 1295                                                  nomem();
1304 1296  
1305 1297                                          level = atoi(arg + 3);
1306 1298                                          if (level > 5)
1307 1299                                                  error(arg);
1308      -                                        if (level >= 2) {
1309      -                                                /*
1310      -                                                 * For gcc-3.4.x at -O2 we
1311      -                                                 * need to disable optimizations
1312      -                                                 * that break ON.
1313      -                                                 */
1314      -                                                optim_disable(ctx->i_ae, level);
1315      -                                                /*
1316      -                                                 * limit -xO3 to -O2 as well.
1317      -                                                 */
1318      -                                                level = 2;
1319      -                                        }
1320 1300                                          (void) snprintf(s, len, "-O%d", level);
1321 1301                                          newae(ctx->i_ae, s);
1322 1302                                          free(s);
1323 1303                                          break;
1324 1304                                  }
1325 1305                                  error(arg);
1326 1306                                  break;
1327 1307                          case 'p':
1328 1308                                  if (strcmp(arg, "-xpentium") == 0) {
1329 1309                                          newae(ctx->i_ae, "-march=pentium");
↓ open down ↓ 584 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX