News for hackers. Stuff that matters.
Re:strcpy: A niche function you don't need by Someone1234 on Friday July 30, 2021 @05:44PM (#28012758)
But then you're undermining your own hard compile time check, wherein specific files or areas of the project could fall through the cracks and continue to used supposedly "banned" functions.

I'd argue doing it globally but as warning would be a better alternative than doing it file by file.

Re:strcpy: A niche function you don't need by jonathrg on Friday July 30, 2021 @05:55PM (#28012886)
A warning would be nice, is there a way to implement that without changing the compiler though?
Re:strcpy: A niche function you don't need by shakna on Friday July 30, 2021 @07:27PM (#28013650)
Something along these lines should work, for at least both of GCC and Clang:

    extern void banned() __attribute__((deprecated("This function is problematic")));

    #define strcpy(...) strcpy(__VA_ARGS__); banned;
Which would output something along the lines of:

    test.c:11:3: warning: 'banned' is deprecated: This function is problematic [-Wdeprecated-declarations]
  strcpy(x, y);
Re:strcpy: A niche function you don't need by yaur on Friday July 30, 2021 @07:27PM (#28013653)
MSVC does this, or at least did the last time I had to compile C code for windows. You should be able to do it with the preprocessor if you wanted to.