First steps with Clang; unknown builtins '__builtin_va_start' and '__builtin_va_end'

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

First steps with Clang; unknown builtins '__builtin_va_start' and '__builtin_va_end'

Francis Gagné

Hello,

I am currently working on some libraries written in C, for which I am writing documentation in an external XML document (using a custom schema), and I would like to use the Clang libraries to check that my documentation is up-to-date (i.e. that all functions/types/members are documented, and that all documented items are still present in the source code.

I started writing some code a bit at random, because the best source of documentation on Clang I could find is the Doxygen documentation, which is not really useful when I don't know what classes or functions I am supposed to use. This is my first experience with Clang, so I'm a bit lost. The following snippet has main0, my first attempt, and main, my second attempt.

http://pastebin.com/T494mbmD

Currently, both fail with the same errors:

c:/mingw/include/stdio.h:245:35: error: use of unknown builtin '__builtin_va_start'
  __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
                                  ^
c:/mingw/include/stdio.h:247:3: error: use of unknown builtin '__builtin_va_end'
  __builtin_va_end( __local_argv );
  ^
 
However, I can successfully compile the source file using clang:
 
K:\>C:\svn\llvm\Debug\bin\clang.exe -c K:\Sources\libasm\src\libasm.c -IK:\Sources\libasm\include -DLIBASM_BUILD_LIB
 
I'm using the latest LLVM and Clang from svn. I'm probably using classes or functions I shouldn't be using, so some assistance on how to prepare the different objects to successfully get an AST would be appreciated. I'm also wondering if I need to use the Sema library or not; all I need to do is check if every element (functions, structs, unions, enums, struct, union and enum members, global variables) in the source code has documentation. The library is composed of several source files, so I need a way of linking declarations/definitions together (from my understanding, 'entities' would be helpful here), and I need to know in which file the definition is (structs are defined in header files, so I need to know what header they were defined in; libasm.h or internal.h).
 
If I can't get this to work, I'll probably end up using the driver to output an XML file with the AST, which I'll compare to my documentation file. Collapsing duplicate declarations might be a bit of a hassle though.
 
Thanks in advance,
 
Francis Gagné
[hidden email]    
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: First steps with Clang; unknown builtins '__builtin_va_start' and '__builtin_va_end'

Eli Friedman
2010/9/13 Francis Gagné <[hidden email]>:

>
> Hello,
>
> I am currently working on some libraries written in C, for which I am writing documentation in an external XML document (using a custom schema), and I would like to use the Clang libraries to check that my documentation is up-to-date (i.e. that all functions/types/members are documented, and that all documented items are still present in the source code.
>
> I started writing some code a bit at random, because the best source of documentation on Clang I could find is the Doxygen documentation, which is not really useful when I don't know what classes or functions I am supposed to use. This is my first experience with Clang, so I'm a bit lost. The following snippet has main0, my first attempt, and main, my second attempt.
>
> http://pastebin.com/T494mbmD
>
> Currently, both fail with the same errors:
>
> c:/mingw/include/stdio.h:245:35: error: use of unknown builtin '__builtin_va_start'
>  __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
>                                  ^
> c:/mingw/include/stdio.h:247:3: error: use of unknown builtin '__builtin_va_end'
>  __builtin_va_end( __local_argv );
>  ^

Have you tried following the example in examples/clang-interpreter/ in
the source tree?  Getting all the setup code exactly right can be
tricky...

-Eli

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: First steps with Clang; unknown builtins '__builtin_va_start' and '__builtin_va_end'

Francis Gagné

> Date: Mon, 13 Sep 2010 18:36:59 -0700
> Subject: Re: [cfe-dev] First steps with Clang; unknown builtins '__builtin_va_start' and '__builtin_va_end'
> From: [hidden email]
> To: [hidden email]
> CC: [hidden email]
>
> 2010/9/13 Francis Gagné :
>>
>> Hello,
>>
>> I am currently working on some libraries written in C, for which I am writing documentation in an external XML document (using a custom schema), and I would like to use the Clang libraries to check that my documentation is up-to-date (i.e. that all functions/types/members are documented, and that all documented items are still present in the source code.
>>
>> I started writing some code a bit at random, because the best source of documentation on Clang I could find is the Doxygen documentation, which is not really useful when I don't know what classes or functions I am supposed to use. This is my first experience with Clang, so I'm a bit lost. The following snippet has main0, my first attempt, and main, my second attempt.
>>
>> http://pastebin.com/T494mbmD
>>
>> Currently, both fail with the same errors:
>>
>> c:/mingw/include/stdio.h:245:35: error: use of unknown builtin '__builtin_va_start'
>> __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
>> ^
>> c:/mingw/include/stdio.h:247:3: error: use of unknown builtin '__builtin_va_end'
>> __builtin_va_end( __local_argv );
>> ^
>
> Have you tried following the example in examples/clang-interpreter/ in
> the source tree? Getting all the setup code exactly right can be
> tricky...
>
> -Eli

This is using the Driver library, which seems to simplify a lot of the work. I thought I would take advantage of the modular structure of Clang, especially since I don't need to do any compilation in my program. There might be an Action subclass for what I want to do that I could use with the Driver library, though.
 
Francis
 
P.S.: I noticed at the last second that I used "Reply" instead of "Reply to all". Sorry if you receive a duplicate, Eli.    
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: First steps with Clang; unknown builtins '__builtin_va_start' and '__builtin_va_end'

Eli Friedman
2010/9/13 Francis Gagné <[hidden email]>:

>
>> Date: Mon, 13 Sep 2010 18:36:59 -0700
>> Subject: Re: [cfe-dev] First steps with Clang; unknown builtins '__builtin_va_start' and '__builtin_va_end'
>> From: [hidden email]
>> To: [hidden email]
>> CC: [hidden email]
>>
>> 2010/9/13 Francis Gagné :
>>>
>>> Hello,
>>>
>>> I am currently working on some libraries written in C, for which I am writing documentation in an external XML document (using a custom schema), and I would like to use the Clang libraries to check that my documentation is up-to-date (i.e. that all functions/types/members are documented, and that all documented items are still present in the source code.
>>>
>>> I started writing some code a bit at random, because the best source of documentation on Clang I could find is the Doxygen documentation, which is not really useful when I don't know what classes or functions I am supposed to use. This is my first experience with Clang, so I'm a bit lost. The following snippet has main0, my first attempt, and main, my second attempt.
>>>
>>> http://pastebin.com/T494mbmD
>>>
>>> Currently, both fail with the same errors:
>>>
>>> c:/mingw/include/stdio.h:245:35: error: use of unknown builtin '__builtin_va_start'
>>> __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
>>> ^
>>> c:/mingw/include/stdio.h:247:3: error: use of unknown builtin '__builtin_va_end'
>>> __builtin_va_end( __local_argv );
>>> ^
>>
>> Have you tried following the example in examples/clang-interpreter/ in
>> the source tree? Getting all the setup code exactly right can be
>> tricky...
>>
>> -Eli
>
> This is using the Driver library, which seems to simplify a lot of the work. I thought I would take advantage of the modular structure of Clang, especially since I don't need to do any compilation in my program. There might be an Action subclass for what I want to do that I could use with the Driver library, though.

Note that you can just write your own action... subclassing
ASTFrontendAction is designed to be straightforward.  For a simple
example, look at lib/Frontend/BoostConAction.cpp and the corresponding
class declaration in include/clang/Frontend/FrontendActions.h.

-Eli

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev