Message ID | 20231218034422.2668628-2-syq@gcc.gnu.org |
---|---|
State | New |
Headers | show |
Series | [1/2] MIPS: host_detect_local_cpu, init ret with concat [PR112759] | expand |
On Mon, Dec 18, 2023 at 11:44:22AM +0800, YunQiang Su wrote: > For reconcat, if the `optr` can only be used as the last one > of string list, aka, we cannot append something to it. > Let's add some note into the document. > > libiberty: > * concat.c (reconcat): Add note about append string to NULL > into document. > --- > libiberty/concat.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/libiberty/concat.c b/libiberty/concat.c > index 4cb1df3baf3..3a6b4ca71e8 100644 > --- a/libiberty/concat.c > +++ b/libiberty/concat.c > @@ -169,6 +169,9 @@ loop: > str = reconcat (str, "pre-", str, NULL); > @end example > > +Note: don't try to append string(s) to the a NULL string, > +as the process will stop at the first NULL argument. > + > @end deftypefn I think this is unnecessary and misleading. The fact that NULL is the variable argument terminator is already clearly documented, and first argument to reconcat can be NULL just fine, so one just needs to be careful. Jakub
diff --git a/libiberty/concat.c b/libiberty/concat.c index 4cb1df3baf3..3a6b4ca71e8 100644 --- a/libiberty/concat.c +++ b/libiberty/concat.c @@ -169,6 +169,9 @@ loop: str = reconcat (str, "pre-", str, NULL); @end example +Note: don't try to append string(s) to the a NULL string, +as the process will stop at the first NULL argument. + @end deftypefn */