https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> --- 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."))); extern __typeof__ (close) safe_close asm("close");