aaron.ballman added a comment.

In D122983#3484064 <https://reviews.llvm.org/D122983#3484064>, @manojgupta 
wrote:

> We are finding a lot of failures in our ToT builds with this change. here is 
> an example for a configure script:
>
> $ cat tent.c
> int  main ()
> {
>  tgetent(0,0);
>  return 0;
> }
> $ bin/clang -c tent.c -Wno-error
> tent.c:3:2: error: call to undeclared function 'tgetent'; ISO C99 and later 
> do not support implicit function declarations 
> [-Wimplicit-function-declaration]
>  tgetent(0,0);
>  ^
> 1 error generated.
>
> It feels very surprising that Wno-error does not suppress this warning. Is 
> that expected?

Yes and no. Warnings which default to an error have very surprising behavior 
(at least to me) in terms of `-Werror` and `-w`. Specifying `-Wno-error` 
doesn't downgrade these diagnostics into a warning 
(https://godbolt.org/z/c43zTqTj1) and specifying `-w` doesn't disable the 
warning (https://godbolt.org/z/Y8YYYecTd). As you can see, that behavior is not 
specific to this patch but is just a general behavior with these kinds of 
diagnostics. I also find the behavior surprising (in both cases), but the last 
time I asked around about it, it sounded like this behavior was intentional for 
some reasons. More exploration is needed to know whether we should make any 
changes there.

In the meantime, `-Wno-error=implicit-function-declaration` should downgrade 
the error to a warning for you (but as you noticed, you can't later re-upgrade 
it into an error; so yes, these things behave a bit strangely IMO).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122983/new/

https://reviews.llvm.org/D122983

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to