Also, <sys/varags.h> is a non-Standard Interface and its use should be
avoided. <stdarg.h> is the Standard conforming Interface.

--Stefan

-----

On 01/08/2013 11:52 AM, Alan Coopersmith wrote:
> If I change it from <sys/varargs.h> to <varargs.h> then gcc reports a more
> useful error:
> /usr/gcc/4.7/lib/gcc/i386-pc-solaris2.11/4.7.2/include/varargs.h:4:2: error:
> #error "GCC no longer implements <varargs.h>."
> /usr/gcc/4.7/lib/gcc/i386-pc-solaris2.11/4.7.2/include/varargs.h:5:2: error:
> #error "Revise your code to use <stdarg.h>."
> 
> Changing the include from <sys/varargs.h> to <stdarg.h> makes it compile 
> without
> any errors or warnings.
> 
>       -alan-
> 
> On 01/ 8/13 08:28 AM, Rao Shoaib wrote:
>> I am porting a 3rd party driver that compiles when using gcc 3.4.3. I want to
>> use the more newer version "gcc (GCC) 4.5.2 " that ships as /usr/bin/gcc.
>> However I am not able to resolve the following issue. Any ideas on how to
>> resolve this issue. This is due to a change in gcc which eliminated
>> __builtin_stdarg_start.
>>
>> nptbld-x:rshoaib:/tmp] (517)>cat y.c
>> #include <sys/types.h>
>> #include <strings.h>
>> #include <sys/varargs.h>
>>
>>
>> int
>> ci_sprintf(char *buf, const char *fmt, ...)
>> {
>>   va_list args;
>>
>> #ifdef WORKS
>>   __builtin_va_start(args, 0);
>> #else
>>   va_start(args, fmt);
>> #endif
>>   (void) vsnprintf(buf, 100, fmt, args);
>>   va_end(args);
>>
>>   return strlen(buf);
>> }
>>
>> main()
>> {
>> }
>>
>>
>> [nptbld-x:rshoaib:/tmp] (519)>gcc y.c -o yc
>> Undefined            first referenced
>>  symbol                  in file
>> __builtin_stdarg_start              /var/tmp//ccE.aiTM.o
>> ld: fatal: symbol referencing errors. No output written to yc
>> collect2: ld returned 1 exit status
>>
>> The only way I have been able to work this out is by using __builtin_va_start
>> instead of va_start. That just seems wrong.
>>
>> Rao.
>> _______________________________________________
>> userland-discuss mailing list
>> [email protected]
>> http://mail.opensolaris.org/mailman/listinfo/userland-discuss
> 
> 


-- 
Stefan Teleman
Oracle USA Corporation
[email protected]

_______________________________________________
userland-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/userland-discuss

Reply via email to