[libcpp, patch] new convenience function: cpp_define_formatted

Daniel Franke franke.daniel@gmail.com
Mon Apr 21 21:42:00 GMT 2008


On Monday 21 April 2008 20:34:23 Tom Tromey wrote:
> Daniel>  /* These are for -D, -U, -A.  */
> Daniel> +void
> Daniel> +cpp_define_formatted (cpp_reader *pfile, const char *fmt, ...)
>
> I'd prefer a more descriptive comment for the function.

See updated patch.


> Daniel> +  buflen = vsnprintf (buf, 0, fmt, ap);
>
> Do we always use the libiberty version of this function?
> A comment there says that the return result is not reliable if using
> the system vsnprintf. 
>
> FWIW, as far as I'm concerned this code could just use vasprintf and
> then free the temporary string.

As I can't answer the first question and found other references to vasprintf 
(which I didn't know before) in gcc, the patch now uses this function.

Recompiled and tested on i686-pc-linux-gnu. Ok?

Regards

	Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cpp_define_formatted.patch
Type: text/x-diff
Size: 3201 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080421/7fe7bf64/attachment.bin>


More information about the Gcc-patches mailing list