va_arg *, and why not.

Gabriel Dos Reis gdr@codesourcery.com
Sun Jul 16 22:15:00 GMT 2000


Mark Mitchell <mark@codesourcery.com> writes:

|   *************** report_diagnostic (msg, args, file, line
|   *** 1479,1491 ****
| 	 int line;
| 	 int warn;
|     {
|       output_state os;
| 
|       if (!count_error (warn))
| 	return;
|       os = diagnostic_buffer->state;
|       diagnostic_msg = msg;
|   !   diagnostic_args = &args;
|       report_error_function (file);
|       output_set_prefix
| 	(diagnostic_buffer, context_as_prefix (file, line, warn));
|   --- 1479,1493 ----
| 	 int line;
| 	 int warn;
|     {
|   +   va_list ap;
|       output_state os;
| 
|       if (!count_error (warn))
| 	return;
|   +   va_copy (ap, args);
|       os = diagnostic_buffer->state;
|       diagnostic_msg = msg;
|   !   diagnostic_args = ≈
|       report_error_function (file);
|       output_set_prefix
| 	(diagnostic_buffer, context_as_prefix (file, line, warn));
|   *************** report_diagnostic (msg, args, file, line
|   *** 1493,1496 ****
|   --- 1495,1499 ----
|       finish_diagnostic ();
|       output_destroy_prefix (diagnostic_buffer);
|       diagnostic_buffer->state = os;
|   +   va_end (ap);
|     }
| 
| 
| It looks like you are using va_copy, which Geoff said isn't fully
| portable.

Hmm, I'm confused there. 
I was under the impression that it was taking the address of a
va_list function argument that was not portable.  Furthermore, in his
proposed resolution using va_copy was one option.

-- Gaby
CodeSourcery, LLC                             http://www.codesourcery.com


More information about the Gcc-bugs mailing list