1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[string] Limit [[nodiscard]] to C++ only

tcc does not know [[nodiscard]]
This commit is contained in:
Witold Filipczyk 2022-01-09 17:52:25 +01:00
parent 39cd902bc0
commit c6860911b5

View File

@ -182,6 +182,7 @@ struct string {
* @returns @a string if successful, or NULL if out of memory.
* @post done_string(@a string) is safe, even if this returned NULL.
* @relates string */
#ifdef _cplusplus
#ifdef DEBUG_MEMLEAK
[[nodiscard]] struct string *init_string__(const char *file, int line, struct string *string);
#define init_string(string) init_string__(__FILE__, __LINE__, string)
@ -189,6 +190,16 @@ struct string {
[[nodiscard]] struct string *init_string(struct string *string);
#endif
#else
#ifdef DEBUG_MEMLEAK
struct string *init_string__(const char *file, int line, struct string *string);
#define init_string(string) init_string__(__FILE__, __LINE__, string)
#else
struct string *init_string(struct string *string);
#endif
#endif
/** Resets @a string and free()s the string.source member.
* @relates string */
void done_string(struct string *string);