Linux SPARSE checker discussions
 help / color / mirror / Atom feed
From: Yura Pakhuchiy <pakhuchiy@gmail.com>
To: linux-sparse@vger.kernel.org
Subject: L'\0' handling
Date: Thu, 08 Apr 2010 17:59:59 +0300	[thread overview]
Message-ID: <1270738799.2167.7.camel@yura-tl> (raw)

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


             reply	other threads:[~2010-04-08 15:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-08 14:59 Yura Pakhuchiy [this message]
2010-04-08 15:22 ` L'\0' handling 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1270738799.2167.7.camel@yura-tl \
    --to=pakhuchiy@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox