Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

util/consideredharmful: Use overloadable func attribute with clang #393

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/util/consideredharmful.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#pragma once
#include "taisei.h"
#include "util/compat.h"

#include <stdio.h>

Expand All @@ -24,17 +25,23 @@ PRAGMA(GCC diagnostic ignored "-Wstrict-prototypes")
// clang generates lots of these warnings with _FORTIFY_SOURCE
PRAGMA(GCC diagnostic ignored "-Wignored-attributes")

#ifdef __GLIBC__
#define OVERLOADABLE __attribute__((overloadable))
#else
#define OVERLOADABLE
#endif

#undef fopen
attr_deprecated("Use vfs_open or SDL_RWFromFile instead")
FILE* fopen();

#undef strncat
attr_deprecated("This function likely doesn't do what you expect, use strlcat")
char* strncat();
char* OVERLOADABLE strncat();

#undef strncpy
attr_deprecated("This function likely doesn't do what you expect, use strlcpy")
char* strncpy();
char* OVERLOADABLE strncpy();

#undef errx
attr_deprecated("Use log_fatal instead")
Expand Down