================
@@ -520,6 +520,9 @@ def warn_drv_math_errno_enabled_after_veclib: Warning<
   "math errno enabled by '%0' after it was implicitly disabled by '%1',"
   " this may limit the utilization of the vector library">,
   InGroup<MathErrnoEnabledWithVecLib>;
+def warn_drv_gcc_incompatible_complex_range_override: Warning<
+  "combination of '%0' and '%1' results in complex number calculations 
incompatible with GCC">,
----------------
s-watanabe314 wrote:

How about using the warning message that Andy suggested 
[here](https://github.com/llvm/llvm-project/pull/132680#issuecomment-2937051423)
 to display which complex range each option implies? In this case, it might be 
simpler to implement if we use the same warning message not only for aggregate 
options (`-ffast-math` and `-ffp-model`) but also for GCC options and 
`-fcomplex-arithmetic=`. The warnings would look something like this:

```
$ clang -ffast-math -fcomplex-arithmetic=full
warning: '-fcomplex-arithmtic=full' sets complex range to "full" overriding the 
setting of "basic" that was implied by '-ffast-math'

$ clang -fcx-fotran-rules -fcx-limited-range
warning: '-fcx-limited-range' sets complex range to "basic" overriding the 
setting of "improved" that was implied by '-fcx-fortran-rules'
```

After modifying the overriding warning message as above, and also outputting 
GCC incompatibility, it might look like this, for example:

```
$ clang -fcx-fortran-rules -fcx-limited-range -Wno-overriding-option 
-Wgcc-compat
warning: complex number calculation is incompatible with GCC; specify 
'-fcx-fortran-rules' after '-fcx-limited-range' for compatibility

$ clang -fcx-fortran-rules -fcx-limited-range -Woverriding-option 
-Wno-gcc-compat
warning: '-fcx-limited-range' sets complex range to "basic" overriding the 
setting of "improved" that was implied by '-fcx-fortran-rules'

$ clang -fcx-fortran-rules -fcx-limited-range -Woverriding-option -Wgcc-compat
warning: '-fcx-limited-range' sets complex range to "basic" overriding the 
setting of "improved" that was implied by '-fcx-fortran-rules' and this is 
incompatible with GCC; specify '-fcx-fortran-rules' after '-fcx-fortran-rules' 
for GCC compatibility
```

I'm a little concerned about the final warning messages becoming long, but what 
do you think about this implementation? If it seems good, I'll try to implement 
it.

I'm not a native English speaker, so I would appreciate any suggestions for 
improving the warning messages.


https://github.com/llvm/llvm-project/pull/144468
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to