linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* L'\0' handling
@ 2010-04-08 14:59 Yura Pakhuchiy
  2010-04-08 15:22 ` Michael Stefaniuc
  0 siblings, 1 reply; 12+ messages in thread
From: Yura Pakhuchiy @ 2010-04-08 14:59 UTC (permalink / raw)
  To: linux-sparse

Hi,

It looks like sparse do not understand constructions like L'\0'.

.-(~)------------------------------------------------------------(yura@yura-tl)-
`--> cat b.c
int main(void)
{
	L'\0';
	return 0;
}
.-(~)------------------------------------------------------------(yura@yura-tl)-
`--> gcc b.c
.-(~)------------------------------------------------------------(yura@yura-tl)-
`--> cgcc b.c
b.c:3:10: error: Expected ; at end of statement
b.c:3:10: error: got `\0'
b.c:3:9: error: undefined identifier `L'

This causes problems with /usr/include/wchar.h
and  /usr/include/bits/wchar.h includes from ubuntu.

/usr/include/bits/wchar.h:38:8: error: garbage at end: `\0' - 1 > 0

/usr/include/wchar.h:393:51: error: Expected ) in expression
/usr/include/wchar.h:393:51: error: got `\0'

Relevant lines from these headers:

extern int __wctob_alias (wint_t __c) __asm ("wctob");
__extern_inline int
__NTH (wctob (wint_t __wc))
{ return (__builtin_constant_p (__wc) && __wc >= L'\0' && __wc <= L'\x7f'
	  ? (int) __wc : __wctob_alias (__wc)); }

and

#ifdef __WCHAR_UNSIGNED__
#define __WCHAR_MIN       L'\0'

/* Failing that, rely on the preprocessor's knowledge of the
   signedness of wchar_t.  */
#elif L'\0' - 1 > 0
#define __WCHAR_MIN       L'\0'
#else
#define __WCHAR_MIN       (-__WCHAR_MAX - 1)
#endif


-- 
Best regards,
        Yura


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2010-06-18  0:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-08 14:59 L'\0' handling Yura Pakhuchiy
2010-04-08 15:22 ` Michael Stefaniuc
2010-04-08 15:39   ` Yura Pakhuchiy
2010-04-08 15:54     ` Michael Stefaniuc
2010-04-08 20:19       ` Christopher Li
     [not found]         ` <1270758815.2167.13.camel@yura-tl>
2010-04-08 20:46           ` Christopher Li
2010-04-08 20:58             ` Michael Stefaniuc
2010-04-08 23:18               ` Christopher Li
2010-04-09  8:57                 ` Michael Stefaniuc
2010-04-09 20:07                   ` Christopher Li
2010-04-09 20:28                     ` Michael Stefaniuc
2010-06-18  0:30                       ` Christopher Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).