/* CPP Library - lexical analysis.
- Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010,
- 2011, 2012 Free Software Foundation, Inc.
+ Copyright (C) 2000-2013 Free Software Foundation, Inc.
Contributed by Per Bothner, 1994-95.
Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
/* Check for unaligned input. */
if (si & 15)
{
+ v16qi sv;
+
if (__builtin_expect (end - s < 16, 0)
&& __builtin_expect ((si & 0xfff) > 0xff0, 0))
{
/* ??? The builtin doesn't understand that the PCMPESTRI read from
memory need not be aligned. */
- __asm ("%vpcmpestri $0, (%1), %2"
- : "=c"(index) : "r"(s), "x"(search), "a"(4), "d"(16));
+ sv = __builtin_ia32_loaddqu ((const char *) s);
+ index = __builtin_ia32_pcmpestri128 (search, 4, sv, 16, 0);
+
if (__builtin_expect (index < 16, 0))
goto found;
{
#define N (sizeof(vc) / sizeof(long))
- typedef char check_count[(N == 2 || N == 4) * 2 - 1];
union {
vc v;
- unsigned long l[N];
+ /* Statically assert that N is 2 or 4. */
+ unsigned long l[(N == 2 || N == 4) ? N : -1];
} u;
unsigned long l, i = 0;
else
cpp_warning_with_line (pfile, CPP_W_NORMALIZE, token->src_loc, 0,
"`%.*s' is not in NFC", (int) sz, buf);
+ free (buf);
}
}
from inttypes.h, we generate a warning and treat the ud-suffix as a
separate preprocessing token. This approach is under discussion by
the standards committee, and has been adopted as a conforming
- extension by other front ends such as clang. */
- if (ISALPHA (*cur))
+ extension by other front ends such as clang.
+ A special exception is made for the suffix 's' which will be
+ standardized as a user-defined literal suffix for strings. */
+ if (ISALPHA (*cur) && *cur != 's')
{
- // Raise a warning, but do not consume subsequent tokens.
+ /* Raise a warning, but do not consume subsequent tokens. */
if (CPP_OPTION (pfile, warn_literal_suffix))
cpp_warning_with_line (pfile, CPP_W_LITERAL_SUFFIX,
token->src_loc, 0,
"a space between literal and identifier");
}
/* Grab user defined literal suffix. */
- else if (*cur == '_')
+ else if (ISIDST (*cur))
{
type = cpp_userdef_string_add_type (type);
++cur;
from inttypes.h, we generate a warning and treat the ud-suffix as a
separate preprocessing token. This approach is under discussion by
the standards committee, and has been adopted as a conforming
- extension by other front ends such as clang. */
- if (ISALPHA (*cur))
+ extension by other front ends such as clang.
+ A special exception is made for the suffix 's' which will be
+ standardized as a user-defined literal suffix for strings. */
+ if (ISALPHA (*cur) && *cur != 's')
{
- // Raise a warning, but do not consume subsequent tokens.
+ /* Raise a warning, but do not consume subsequent tokens. */
if (CPP_OPTION (pfile, warn_literal_suffix))
cpp_warning_with_line (pfile, CPP_W_LITERAL_SUFFIX,
token->src_loc, 0,
"a space between literal and identifier");
}
/* Grab user defined literal suffix. */
- else if (*cur == '_')
+ else if (ISIDST (*cur))
{
type = cpp_userdef_char_add_type (type);
type = cpp_userdef_string_add_type (type);
{
if (*buffer->cur == ':')
{
+ /* C++11 [2.5/3 lex.pptoken], "Otherwise, if the next
+ three characters are <:: and the subsequent character
+ is neither : nor >, the < is treated as a preprocessor
+ token by itself". */
+ if (CPP_OPTION (pfile, cplusplus)
+ && CPP_OPTION (pfile, lang) != CLK_CXX98
+ && CPP_OPTION (pfile, lang) != CLK_GNUCXX
+ && buffer->cur[1] == ':'
+ && buffer->cur[2] != ':' && buffer->cur[2] != '>')
+ break;
+
buffer->cur++;
result->flags |= DIGRAPH;
result->type = CPP_OPEN_SQUARE;
len = MIN_BUFF_SIZE;
len = CPP_ALIGN (len);
+#ifdef ENABLE_VALGRIND_CHECKING
+ /* Valgrind warns about uses of interior pointers, so put _cpp_buff
+ struct first. */
+ size_t slen = CPP_ALIGN2 (sizeof (_cpp_buff), 2 * DEFAULT_ALIGNMENT);
+ base = XNEWVEC (unsigned char, len + slen);
+ result = (_cpp_buff *) base;
+ base += slen;
+#else
base = XNEWVEC (unsigned char, len + sizeof (_cpp_buff));
result = (_cpp_buff *) (base + len);
+#endif
result->base = base;
result->cur = base;
result->limit = base + len;
for (; buff; buff = next)
{
next = buff->next;
+#ifdef ENABLE_VALGRIND_CHECKING
+ free (buff);
+#else
free (buff->base);
+#endif
}
}