[cfe-dev] Clang tutorial

Eli Friedman eli.friedman at gmail.com
Wed May 27 04:15:19 PDT 2009


On Wed, May 27, 2009 at 4:00 AM, Simone Pellegrini
<spellegrini at dps.uibk.ac.at> wrote:
> In file included from bench/example.c:8:
> In file included from /usr/include/stdio.h:72:
> In file included from /usr/include/libio.h:32:
> /usr/include/_G_config.h:50:25: warning: field '__cd' with variable sized
> type 'struct __gconv_info' not at the end of a struct or class is a GNU
> extension

You might want to use "Diags.setSuppressSystemWarnings(true);" to get
rid of warnings from system headers, since they're generally not
useful.

> (gdb) backtrace
> #0  0x00000000005909ff in Lexer (this=0x7fbfff7140, fileloc={ID = 91216},
> features=@0x0,
>   BufStart=0x8fb780 "/* This file is needed by libio to define various
> configuration parameters.\n   These are always the same in the GNU C
> library.  */\n\n#ifndef _G_config_h\n#define _G_config_h 1\n\n/* Define
> types for libio"...,
>   BufPtr=0x8fbc4a "__cd;\n    struct __gconv_step_data __data;\n  }
> __combined;\n} _G_iconv_t;\n\ntypedef int _G_int16_t __attribute__
> ((__mode__ (__HI__)));\ntypedef int _G_int32_t __attribute__ ((__mode__
> (__SI__)));\ntypede"..., BufEnd=0x8fc1f0 "") at Lexer.cpp:116
> #1  0x000000000059445f in clang::Lexer::MeasureTokenLength (Loc={ID =
> 91216}, SM=@0x7fbfffec90, LangOpts=@0x0) at Lexer.cpp:235
> #2  0x00000000005bdc88 in clang::TextDiagnosticPrinter::EmitCaretDiagnostic
> (this=0x8c2610, Loc={ID = 91216}, Ranges=0x7fbfff74b0, NumRanges=0,
> SM=@0x7fbfffec90,

I think you want something like the
"DiagClient.setLangOptions(&LangInfo);" call in my example.

-Eli




More information about the cfe-dev mailing list