[cfe-commits] r64708 - in /cfe/trunk: Driver/clang.cpp test/Sema/unused-expr.c

Daniel Dunbar daniel at zuster.org
Tue Feb 17 00:13:39 PST 2009


Hi Chris,

This wasn't really needed (see the codegen test case, for example),
-fmath-errno=0 already worked. This is a higher level question of
whether we should go to any effort to support gcc style options in the
clang binary; my feeling is it is a bit silly to accept both LLVM
style and gcc style.

 - Daniel

On Mon, Feb 16, 2009 at 4:35 PM, Chris Lattner <sabre at nondot.org> wrote:
> Author: lattner
> Date: Mon Feb 16 18:35:09 2009
> New Revision: 64708
>
> URL: http://llvm.org/viewvc/llvm-project?rev=64708&view=rev
> Log:
> add support for -fno-math-errno, and validate that it affects sema properly.
>
> Modified:
>    cfe/trunk/Driver/clang.cpp
>    cfe/trunk/test/Sema/unused-expr.c
>
> Modified: cfe/trunk/Driver/clang.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=64708&r1=64707&r2=64708&view=diff
>
> ==============================================================================
> --- cfe/trunk/Driver/clang.cpp (original)
> +++ cfe/trunk/Driver/clang.cpp Mon Feb 16 18:35:09 2009
> @@ -219,7 +219,7 @@
>  static llvm::cl::opt<bool>
>  MathErrno("fmath-errno",
>           llvm::cl::desc("Require math functions to respect errno"),
> -          llvm::cl::init(true));
> +          llvm::cl::init(true), llvm::cl::AllowInverse);
>
>  //===----------------------------------------------------------------------===//
>  // Analyzer Options.
>
> Modified: cfe/trunk/test/Sema/unused-expr.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/unused-expr.c?rev=64708&r1=64707&r2=64708&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/Sema/unused-expr.c (original)
> +++ cfe/trunk/test/Sema/unused-expr.c Mon Feb 16 18:35:09 2009
> @@ -1,7 +1,9 @@
> -// RUN: clang -fsyntax-only -verify %s
> +// RUN: clang -fsyntax-only -verify -fno-math-errno %s
>
>  int foo(int X, int Y);
>
> +double sqrt(double X);  // implicitly const because of -fno-math-errno!
> +
>  void bar(volatile int *VP, int *P, int A,
>          _Complex double C, volatile _Complex double VC) {
>
> @@ -21,6 +23,9 @@
>
>   __real__ C;          // expected-warning {{expression result unused}}
>   __real__ VC;
> +
> +  // We know this can't change errno because of -fno-math-errno.
> +  sqrt(A);  // expected-warning {{expression result unused}}
>  }
>
>  extern void t1();
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>



More information about the cfe-commits mailing list