<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">hi guys, i write a programme using libclang , as follows<br><br>//clang_test.cpp<br>int main( int argc, char** argv )<br>{<br> CXIndex Index = clang_createIndex( 0, 0 );<br> CXTranslationUnit TU = clang_parseTranslationUnit( Index, 0, argv, argc, 0, 0, CXTranslationUnit_None );<br><br> if(TU == NULL)<br> return -1;<br><br> for( unsigned I=0, N=clang_getNumDiagnostics( TU ); I<N; ++I )<br> {<br> CXDiagnostic Diag = clang_getDiagnostic( TU, I );<br> /*<br> */<br> CXString String = clang_formatDiagnostic( Diag, clang_defaultDiagnosticDisplayOptions()
);<br> fprintf( stderr, "Diag: %s\n", clang_getCString( String ) );<br> clang_disposeString( String );<br><br> /*<br> */<br> for( unsigned J=0, M=clang_getDiagnosticNumFixIts( Diag ); J!=M; ++J )<br> {<br> CXSourceRange Range;<br> CXString Str2 = clang_getDiagnosticFixIt( Diag, J, &Range );<br> const char* str = clang_getCString( Str2 );<br> if( str!= 0 )<br>
{<br> fprintf( stderr, "FixIt: %s\n", str );<br> CXSourceLocation Start = clang_getRangeStart( Range );<br> CXSourceLocation End = clang_getRangeEnd( Range );<br> unsigned line = 0;<br> unsigned column = 0;<br> clang_getSpellingLocation( Start, 0, &line, &column, 0 );<br> fprintf( stderr, "Range start: line [%d], column
[%d]\n", line, column );<br> clang_getSpellingLocation( End, 0, &line, &column, 0 );<br> fprintf( stderr, "Range end: line [%d], column [%d]\n", line, column );<br> }<br><br> clang_disposeString( Str2 );<br> }<br> clang_disposeDiagnostic(Diag);<br> }<br><br> clang_disposeTranslationUnit( TU );<br> clang_disposeIndex( Index );<br> return 0;<br>}<br>//test.cpp<br>#include <stdio.h><br><br>int PrintExtent( )<br>{<br>}<br><br>when run ./clang_test test.cpp, it prints <br>Diag:
warning: ./clang_test: 'linker' input unused when '-fsyntax-only' is present<br>Diag: test.cpp:5:1: warning: control reaches end of non-void function [-Wreturn-type]<br><br>My question is why does it print the first message, and how can i forbid it to print this message.<br><br>Thanks.<br></td></tr></table><br>