comparison libcpp/charset.c @ 63:b7f97abdc517 gcc-4.6-20100522

update gcc from gcc-4.5.0 to gcc-4.6
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Mon, 24 May 2010 12:47:05 +0900
parents 77e2b8dfacca
children f6334be47118
comparison
equal deleted inserted replaced
56:3c8a44c06a95 63:b7f97abdc517
991 991
992 if (!CPP_OPTION (pfile, cplusplus) && !CPP_OPTION (pfile, c99)) 992 if (!CPP_OPTION (pfile, cplusplus) && !CPP_OPTION (pfile, c99))
993 cpp_error (pfile, CPP_DL_WARNING, 993 cpp_error (pfile, CPP_DL_WARNING,
994 "universal character names are only valid in C++ and C99"); 994 "universal character names are only valid in C++ and C99");
995 else if (CPP_WTRADITIONAL (pfile) && identifier_pos == 0) 995 else if (CPP_WTRADITIONAL (pfile) && identifier_pos == 0)
996 cpp_error (pfile, CPP_DL_WARNING, 996 cpp_warning (pfile, CPP_W_TRADITIONAL,
997 "the meaning of '\\%c' is different in traditional C", 997 "the meaning of '\\%c' is different in traditional C",
998 (int) str[-1]); 998 (int) str[-1]);
999 999
1000 if (str[-1] == 'u') 1000 if (str[-1] == 'u')
1001 length = 4; 1001 length = 4;
1002 else if (str[-1] == 'U') 1002 else if (str[-1] == 'U')
1003 length = 8; 1003 length = 8;
1172 int digits_found = 0; 1172 int digits_found = 0;
1173 size_t width = cvt.width; 1173 size_t width = cvt.width;
1174 size_t mask = width_to_mask (width); 1174 size_t mask = width_to_mask (width);
1175 1175
1176 if (CPP_WTRADITIONAL (pfile)) 1176 if (CPP_WTRADITIONAL (pfile))
1177 cpp_error (pfile, CPP_DL_WARNING, 1177 cpp_warning (pfile, CPP_W_TRADITIONAL,
1178 "the meaning of '\\x' is different in traditional C"); 1178 "the meaning of '\\x' is different in traditional C");
1179 1179
1180 from++; /* Skip 'x'. */ 1180 from++; /* Skip 'x'. */
1181 while (from < limit) 1181 while (from < limit)
1182 { 1182 {
1183 c = *from; 1183 c = *from;
1300 case 't': c = charconsts[6]; break; 1300 case 't': c = charconsts[6]; break;
1301 case 'v': c = charconsts[7]; break; 1301 case 'v': c = charconsts[7]; break;
1302 1302
1303 case 'a': 1303 case 'a':
1304 if (CPP_WTRADITIONAL (pfile)) 1304 if (CPP_WTRADITIONAL (pfile))
1305 cpp_error (pfile, CPP_DL_WARNING, 1305 cpp_warning (pfile, CPP_W_TRADITIONAL,
1306 "the meaning of '\\a' is different in traditional C"); 1306 "the meaning of '\\a' is different in traditional C");
1307 c = charconsts[0]; 1307 c = charconsts[0];
1308 break; 1308 break;
1309 1309
1310 case 'e': case 'E': 1310 case 'e': case 'E':
1311 if (CPP_PEDANTIC (pfile)) 1311 if (CPP_PEDANTIC (pfile))
1394 const uchar *prefix; 1394 const uchar *prefix;
1395 1395
1396 /* Skip over 'R"'. */ 1396 /* Skip over 'R"'. */
1397 p += 2; 1397 p += 2;
1398 prefix = p; 1398 prefix = p;
1399 while (*p != '[') 1399 while (*p != '(')
1400 p++; 1400 p++;
1401 p++; 1401 p++;
1402 limit = from[i].text + from[i].len; 1402 limit = from[i].text + from[i].len;
1403 if (limit >= p + (p - prefix) + 1) 1403 if (limit >= p + (p - prefix) + 1)
1404 limit -= (p - prefix) + 1; 1404 limit -= (p - prefix) + 1;
1405 1405
1406 for (;;) 1406 /* Raw strings are all normal characters; these can be fed
1407 { 1407 directly to convert_cset. */
1408 base = p; 1408 if (!APPLY_CONVERSION (cvt, p, limit - p, &tbuf))
1409 while (p < limit && (*p != '\\' || (p[1] != 'u' && p[1] != 'U'))) 1409 goto fail;
1410 p++;
1411 if (p > base)
1412 {
1413 /* We have a run of normal characters; these can be fed
1414 directly to convert_cset. */
1415 if (!APPLY_CONVERSION (cvt, base, p - base, &tbuf))
1416 goto fail;
1417 }
1418 if (p == limit)
1419 break;
1420
1421 p = convert_ucn (pfile, p + 1, limit, &tbuf, cvt);
1422 }
1423 1410
1424 continue; 1411 continue;
1425 } 1412 }
1426 1413
1427 p++; /* Skip leading quote. */ 1414 p++; /* Skip leading quote. */
1520 i = max_chars; 1507 i = max_chars;
1521 cpp_error (pfile, CPP_DL_WARNING, 1508 cpp_error (pfile, CPP_DL_WARNING,
1522 "character constant too long for its type"); 1509 "character constant too long for its type");
1523 } 1510 }
1524 else if (i > 1 && CPP_OPTION (pfile, warn_multichar)) 1511 else if (i > 1 && CPP_OPTION (pfile, warn_multichar))
1525 cpp_error (pfile, CPP_DL_WARNING, "multi-character character constant"); 1512 cpp_warning (pfile, CPP_W_MULTICHAR, "multi-character character constant");
1526 1513
1527 /* Multichar constants are of type int and therefore signed. */ 1514 /* Multichar constants are of type int and therefore signed. */
1528 if (i > 1) 1515 if (i > 1)
1529 unsigned_p = 0; 1516 unsigned_p = 0;
1530 else 1517 else