soi-header/include/bits/soi-deprecate.hpp

94 lines
3.9 KiB
C++
Raw Normal View History

// Copyright Johannes Kapfhammer 2019-2022.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
2022-03-31 21:41:11 +02:00
#ifndef SOI_HEADER_DEPRECATE
#define SOI_HEADER_DEPRECATE
2019-10-06 16:45:29 +02:00
#pragma GCC diagnostic error "-Wdeprecated-declarations"
2019-10-06 18:38:23 +02:00
struct endl_is_evil_t {
} endl_is_evil;
[[deprecated("endl is evil. Use '\\n' to print a newline.")]] std::ostream &
operator<<(std::ostream &os, endl_is_evil_t);
2019-10-06 16:45:29 +02:00
#define endl endl_is_evil
#define printf printf_is_evil
#define fprintf fprintf_is_evil
#define sprintf sprintf_is_evil
#define snprintf snprintf_is_evil
2019-10-06 18:38:23 +02:00
[[deprecated("printf is evil. Use cout.")]] int printf(const char *format,
...);
[[deprecated("printf is evil. Use cout.")]] int
fprintf(std::FILE *stream, const char *format, ...);
[[deprecated("printf is evil. Use cout.")]] int
sprintf(char *buffer, const char *format, ...);
[[deprecated("printf is evil. Use cout.")]] int
snprintf(char *buffer, std::size_t buf_size, const char *format, ...);
2019-10-06 16:45:29 +02:00
#define scanf scanf_is_evil
#define fscanf fscanf_is_evil
#define sscanf sscanf_is_evil
[[deprecated("scanf is evil. Use cin.")]] int scanf(const char *format, ...);
2019-10-06 18:38:23 +02:00
[[deprecated("scanf is evil. Use cin.")]] int fscanf(std::FILE *stream,
const char *format, ...);
[[deprecated("scanf is evil. Use cin.")]] int sscanf(const char *buffer,
const char *format, ...);
2019-10-06 16:45:29 +02:00
#define puts puts_is_evil
#define fputs fputs_is_evil
#define fgets fgets_is_evil
#define fopen fopen_is_evil
#define fclose fclose_is_evil
#define fflush fflush_is_evil
#define getchar getchar_is_evil
#define fgetc fgetc_is_evil
#define getc getc_is_evil
#define setbuf setbuf_is_evil
#define setvbuf setvbuf_is_evil
#define fread fread_is_evil
#define fwrite fwrite_is_evil
[[deprecated("<cstdio> is evil. Use cin/cout.")]] int puts(const char *str);
2019-10-06 18:38:23 +02:00
[[deprecated("<cstdio> is evil. Use cin/cout.")]] int fputs(const char *str,
FILE *stream);
[[deprecated("<cstdio> is evil. Use cin/cout.")]] char *
fgets(char *str, int count, FILE *stream);
[[deprecated("<cstdio> is evil. Use cin/cout.")]] std::FILE *
fopen(const char *filename, const char *mode);
[[deprecated("<cstdio> is evil. Use cin/cout.")]] int
fclose(std::FILE *stream);
[[deprecated("<cstdio> is evil. Use cin/cout.")]] int
fflush(std::FILE *stream);
2019-10-06 16:45:29 +02:00
[[deprecated("<cstdio> is evil. Use cin/cout.")]] int getchar();
[[deprecated("<cstdio> is evil. Use cin/cout.")]] int fgetc(std::FILE *stream);
[[deprecated("<cstdio> is evil. Use cin/cout.")]] int getc(std::FILE *stream);
2019-10-06 18:38:23 +02:00
[[deprecated("<cstdio> is evil. Use cin/cout.")]] void
setbuf(std::FILE *stream, char *buffer);
[[deprecated("<cstdio> is evil. Use cin/cout.")]] int
setvbuf(std::FILE *stream, char *buffer, int mode, std::size_t size);
[[deprecated("<cstdio> is evil. Use cin/cout.")]] std::size_t
fread(void *buffer, std::size_t size, std::size_t count, std::FILE *stream);
[[deprecated("<cstdio> is evil. Use cin/cout.")]] std::size_t
fwrite(const void *buffer, std::size_t size, std::size_t count,
std::FILE *stream);
2019-10-06 16:45:29 +02:00
#define malloc malloc_is_evil
#define calloc calloc_is_evil
#define realloc realloc_is_evil
#define free free_is_evil
2019-10-06 18:38:23 +02:00
[[deprecated("malloc/free is evil. Use a vector.")]] void *
malloc(std::size_t size);
[[deprecated("malloc/free is evil. Use a vector.")]] void *
calloc(std::size_t num, std::size_t size);
[[deprecated("malloc/free is evil. Use a vector.")]] void *
realloc(void *ptr, std::size_t new_size);
[[deprecated("malloc/free is evil. Use a vector.")]] void *
free(void *ptr, std::size_t new_size);
2019-10-06 16:45:29 +02:00
//[[deprecated("new is evil. Use a vector.")]] void *
//operator new(std::size_t sz);
//[[deprecated("delete is evil. Use a vector.")]] void
//operator delete(void *ptr) noexcept;
2022-03-31 21:41:11 +02:00
#endif // SOI_HEADER_DEPRECATE