Skip to content

Commit 9cbad80

Browse files
committed
Add deprecations
1 parent 28a3aae commit 9cbad80

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/xy.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,17 @@
3131
#include <string.h>
3232
#include <unistd.h>
3333

34+
#if defined(__STDC__) && __STDC_VERSION__ >= 202311
35+
#define XY_Dreprecate_This(msg) [[deprecated(msg)]]
36+
#elif defined(__GNUC__) || defined(__clang__)
37+
#define XY_Deprecate_This(msg) __attribute__((deprecated(msg)))
38+
#elif defined(_MSC_VER)
39+
#define XY_Deprecate_This(msg) __declspec(deprecated(msg))
40+
#else
41+
#define XY_Deprecate_This(msg)
42+
#endif
43+
44+
3445
/* Global */
3546
bool xy_enable_color = true;
3647

@@ -74,9 +85,13 @@ bool xy_enable_color = true;
7485
#define xy_useutf8()
7586
#endif
7687

88+
XY_Deprecate_This("Not use anymore")
7789
void putf (double n) { printf ("%f\n", n); }
90+
XY_Deprecate_This("Not use anymore")
7891
void puti (long long n) { printf ("%lld\n", n); }
92+
XY_Deprecate_This("Not use anymore")
7993
void putb (bool n) { if (n) puts ("true"); else puts ("false"); }
94+
8095
void print (const char *s) { printf ("%s", s); }
8196
void println (const char *s) { printf ("%s\n", s); }
8297
void say (const char *s) { printf ("%s\n", s); }

0 commit comments

Comments
 (0)