diff options
author | Alexander Smirnov <alex@ydb.tech> | 2024-07-08 15:54:05 +0000 |
---|---|---|
committer | Alexander Smirnov <alex@ydb.tech> | 2024-07-08 15:54:05 +0000 |
commit | fc7be18c76af2e700641f3598c4856baeef1428e (patch) | |
tree | 11dbca45eb321c3a4dd08b12152acc6ef5dd3fa9 /contrib/tools/bison/src/uniqstr.h | |
parent | ec0e7ed6da6fb317741fd8468602949a1362eca5 (diff) | |
parent | c92cb9d3a19331916f0c274d80e67f02a62caa9b (diff) | |
download | ydb-fc7be18c76af2e700641f3598c4856baeef1428e.tar.gz |
Merge branch 'rightlib' into mergelibs-240708-1553
Diffstat (limited to 'contrib/tools/bison/src/uniqstr.h')
-rw-r--r-- | contrib/tools/bison/src/uniqstr.h | 47 |
1 files changed, 9 insertions, 38 deletions
diff --git a/contrib/tools/bison/src/uniqstr.h b/contrib/tools/bison/src/uniqstr.h index 006c10f4ad..1fd731807f 100644 --- a/contrib/tools/bison/src/uniqstr.h +++ b/contrib/tools/bison/src/uniqstr.h @@ -1,6 +1,7 @@ /* Keeping a unique copy of strings. - Copyright (C) 2002-2003, 2008-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2008-2015, 2018-2019 Free Software + Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -20,6 +21,8 @@ #ifndef UNIQSTR_H_ # define UNIQSTR_H_ +# include <stdio.h> + /*-----------------------------------------. | Pointers to unique copies of C strings. | `-----------------------------------------*/ @@ -29,12 +32,6 @@ typedef char const *uniqstr; /* Return the uniqstr for STR. */ uniqstr uniqstr_new (char const *str); -/* Return a uniqstr built by vsprintf. In order to simply concatenate - strings, use UNIQSTR_CONCAT, which is a convenient wrapper around - this function. */ -uniqstr uniqstr_vsprintf (char const *format, ...) - __attribute__ ((__format__ (__printf__, 1, 2))); - /* Two uniqstr values have the same value iff they are the same. */ # define UNIQSTR_EQ(Ustr1, Ustr2) (!!((Ustr1) == (Ustr2))) @@ -49,38 +46,12 @@ void uniqstr_assert (char const *str); | Concatenation. | `----------------*/ -/* Concatenate at most 20 strings and return a uniqstr. The goal of - this macro is to make the caller's code a little more succinct - without a trivial uniqstr_vsprintf format string to maintain - (for example, "%s%s%s") while still benefitting from gcc's type - checking. Unfortunately, because of the missing format string in the - macro invocation, the argument number reported by gcc for a bad - argument type is 1 too large. */ +/* Concatenate strings and return a uniqstr. The goal of + this macro is to make the caller's code a little more succinct. */ # define UNIQSTR_CONCAT(...) \ - uniqstr_vsprintf (UNIQSTR_GEN_FORMAT (__VA_ARGS__, \ - "%s", "%s", "%s", "%s", "%s", \ - "%s", "%s", "%s", "%s", "%s", \ - "%s", "%s", "%s", "%s", "%s", \ - "%s", "%s", "%s", "%s", "%s"), \ - __VA_ARGS__) - -# define UNIQSTR_GEN_FORMAT(F1, F2, F3, F4, F5, \ - F6, F7, F8, F9, F10, \ - F11, F12, F13, F14, F15, \ - F16, F17, F18, F19, F20, \ - ...) \ - UNIQSTR_GEN_FORMAT_ (__VA_ARGS__, \ - "", "", "", "", "", \ - "", "", "", "", "", \ - "", "", "", "", "", \ - "", "", "", "", "") - -# define UNIQSTR_GEN_FORMAT_(F1, F2, F3, F4, F5, \ - F6, F7, F8, F9, F10, \ - F11, F12, F13, F14, F15, \ - F16, F17, F18, F19, F20, ...) \ - F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 \ - F11 F12 F13 F14 F15 F16 F17 F18 F19 F20 + uniqstr_concat (ARRAY_CARDINALITY (((char const *[]) {__VA_ARGS__})), \ + __VA_ARGS__) +uniqstr uniqstr_concat (int nargs, ...); /*--------------------. | Table of uniqstrs. | |