[Bug c++/43881] warning attached to a function is emitted even though the function is not being called

2021-06-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881 --- Comment #6 from Andrew Pinski --- The best way to do this is to use asm instead: extern "C" int close(int); extern __typeof__ (close) close __attribute__ ((__warning__ ("The symbol close refers to the system function. Use safe_close instead."

[Bug c++/43881] warning attached to a function is emitted even though the function is not being called

2010-04-25 Thread rguenth at gcc dot gnu dot org
--- Comment #5 from rguenth at gcc dot gnu dot org 2010-04-25 20:13 --- (In reply to comment #4) > (In reply to comment #2) > > It is called directly because safe_close's value is replaced in the > > indirect call. Since safe_close is static and not changed in the code > > at all, it

[Bug c++/43881] warning attached to a function is emitted even though the function is not being called

2010-04-24 Thread bruno at clisp dot org
--- Comment #4 from bruno at clisp dot org 2010-04-24 23:58 --- (In reply to comment #2) > It is called directly because safe_close's value is replaced in the > indirect call. Since safe_close is static and not changed in the code > at all, it is marked as read only and the initializ

[Bug c++/43881] warning attached to a function is emitted even though the function is not being called

2010-04-24 Thread bruno at clisp dot org
--- Comment #3 from bruno at clisp dot org 2010-04-24 23:54 --- When the line static int (*safe_close) (int fd) = close; is changed to static int (*safe_close) (int fd) = ((void)0, close); the warning also disappears, but then the generate code is suboptimal: the variable safe_close

[Bug c++/43881] warning attached to a function is emitted even though the function is not being called

2010-04-24 Thread pinskia at gmail dot com
--- Comment #2 from pinskia at gmail dot com 2010-04-24 23:12 --- Subject: Re: New: warning attached to a function is emitted even though the function is not being called It is called directly because safe_close's value is replaced in the indirect call. Since safe_close is static an

[Bug c++/43881] warning attached to a function is emitted even though the function is not being called

2010-04-24 Thread bruno at clisp dot org
--- Comment #1 from bruno at clisp dot org 2010-04-24 22:49 --- Created an attachment (id=20479) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20479&action=view) test case -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881