• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


コミットメタ情報

リビジョン147b898422f13f616722d0690214d70fe3f7f302 (tree)
日時2003-12-20 15:05:40
作者Daniel Jacobowitz <drow@fals...>
コミッターDaniel Jacobowitz

ログメッセージ

* cp-names.y (tokentab2, tokentab3): Remove.
(HANDLE_TOKEN2, HANDLE_TOKEN3): New macros.
(yylex): Use them.

変更サマリ

差分

--- a/gdb/ChangeLog.cplus
+++ b/gdb/ChangeLog.cplus
@@ -1,5 +1,11 @@
11 2003-12-19 Daniel Jacobowitz <drow@mvista.com>
22
3+ * cp-names.y (tokentab2, tokentab3): Remove.
4+ (HANDLE_TOKEN2, HANDLE_TOKEN3): New macros.
5+ (yylex): Use them.
6+
7+2003-12-19 Daniel Jacobowitz <drow@mvista.com>
8+
39 * cp-names.y (%union): Remove typed_val_float.
410 (INT, FLOAT): Change to type comp.
511 (CONSTRUCTION_VTABLE): Change to untyped.
--- a/gdb/cp-names.y
+++ b/gdb/cp-names.y
@@ -1413,36 +1413,6 @@ struct token
14131413 int opcode;
14141414 };
14151415
1416-static const struct token tokentab3[] =
1417- {
1418- {">>=", ASSIGN_MODIFY, BINOP_RSH},
1419- {"<<=", ASSIGN_MODIFY, BINOP_LSH},
1420- };
1421-
1422-static const struct token tokentab2[] =
1423- {
1424- {"+=", ASSIGN_MODIFY, BINOP_ADD},
1425- {"-=", ASSIGN_MODIFY, BINOP_SUB},
1426- {"*=", ASSIGN_MODIFY, BINOP_MUL},
1427- {"/=", ASSIGN_MODIFY, BINOP_DIV},
1428- {"%=", ASSIGN_MODIFY, BINOP_REM},
1429- {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR},
1430- {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND},
1431- {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR},
1432- {"++", INCREMENT, BINOP_END},
1433- {"--", DECREMENT, BINOP_END},
1434- {"->", ARROW, BINOP_END},
1435- {"&&", ANDAND, BINOP_END},
1436- {"||", OROR, BINOP_END},
1437- {"::", COLONCOLON, BINOP_END},
1438- {"<<", LSH, BINOP_END},
1439- {">>", RSH, BINOP_END},
1440- {"==", EQUAL, BINOP_END},
1441- {"!=", NOTEQUAL, BINOP_END},
1442- {"<=", LEQ, BINOP_END},
1443- {">=", GEQ, BINOP_END}
1444- };
1445-
14461416 #define HANDLE_SPECIAL(string, len, comp) \
14471417 if (strncmp (tokstart, string, len) == 0) \
14481418 { \
@@ -1451,6 +1421,22 @@ static const struct token tokentab2[] =
14511421 return DEMANGLER_SPECIAL; \
14521422 }
14531423
1424+#define HANDLE_TOKEN2(string, token, op) \
1425+ if (lexptr[1] == string[1]) \
1426+ { \
1427+ lexptr += 2; \
1428+ yylval.opname = string; \
1429+ return token; \
1430+ }
1431+
1432+#define HANDLE_TOKEN3(string, token, op) \
1433+ if (lexptr[1] == string[1] && lexptr[2] == string[2]) \
1434+ { \
1435+ lexptr += 2; \
1436+ yylval.opname = string; \
1437+ return token; \
1438+ }
1439+
14541440 /* Read one token, getting characters through lexptr. */
14551441
14561442 static int
@@ -1458,7 +1444,6 @@ yylex (void)
14581444 {
14591445 int c;
14601446 int namelen;
1461- unsigned int i;
14621447 char *tokstart;
14631448 char *tokptr;
14641449 int tempbufindex;
@@ -1472,26 +1457,6 @@ yylex (void)
14721457 unquoted_expr = 1;
14731458
14741459 tokstart = lexptr;
1475- /* See if it is a special token of length 3. */
1476- for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
1477- if (tokstart[0] == tokentab3[i].operator[0]
1478- && tokstart[1] == tokentab3[i].operator[1]
1479- && tokstart[2] == tokentab3[i].operator[2])
1480- {
1481- lexptr += 3;
1482- yylval.opname = tokentab3[i].operator;
1483- return tokentab3[i].token;
1484- }
1485-
1486- /* See if it is a special token of length 2. */
1487- for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
1488- if (tokstart[0] == tokentab2[i].operator[0]
1489- && tokstart[1] == tokentab2[i].operator[1])
1490- {
1491- lexptr += 2;
1492- yylval.opname = tokentab2[i].operator;
1493- return tokentab2[i].token;
1494- }
14951460
14961461 switch (c = *tokstart)
14971462 {
@@ -1561,6 +1526,10 @@ yylex (void)
15611526 /* FALL THRU into number case. */
15621527
15631528 case '-':
1529+ HANDLE_TOKEN2 ("-=", ASSIGN_MODIFY, BINOP_SUB);
1530+ HANDLE_TOKEN2 ("--", DECREMENT, BINOP_END);
1531+ HANDLE_TOKEN2 ("->", ARROW, BINOP_END);
1532+
15641533 /* For construction vtables. This is kind of hokey. */
15651534 if (strncmp (tokstart, "-in-", 4) == 0)
15661535 {
@@ -1643,22 +1612,66 @@ yylex (void)
16431612 }
16441613
16451614 case '+':
1615+ HANDLE_TOKEN2 ("+=", ASSIGN_MODIFY, BINOP_ADD);
1616+ HANDLE_TOKEN2 ("++", INCREMENT, BINOP_END);
1617+ lexptr++;
1618+ return c;
16461619 case '*':
1620+ HANDLE_TOKEN2 ("*=", ASSIGN_MODIFY, BINOP_MUL);
1621+ lexptr++;
1622+ return c;
16471623 case '/':
1624+ HANDLE_TOKEN2 ("/=", ASSIGN_MODIFY, BINOP_DIV);
1625+ lexptr++;
1626+ return c;
16481627 case '%':
1628+ HANDLE_TOKEN2 ("%=", ASSIGN_MODIFY, BINOP_REM);
1629+ lexptr++;
1630+ return c;
16491631 case '|':
1632+ HANDLE_TOKEN2 ("|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR);
1633+ HANDLE_TOKEN2 ("||", OROR, BINOP_END);
1634+ lexptr++;
1635+ return c;
16501636 case '&':
1637+ HANDLE_TOKEN2 ("&=", ASSIGN_MODIFY, BINOP_BITWISE_AND);
1638+ HANDLE_TOKEN2 ("&&", ANDAND, BINOP_END);
1639+ lexptr++;
1640+ return c;
16511641 case '^':
1652- case '~':
1642+ HANDLE_TOKEN2 ("^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR);
1643+ lexptr++;
1644+ return c;
16531645 case '!':
1654- case '@':
1646+ HANDLE_TOKEN2 ("!=", NOTEQUAL, BINOP_END);
1647+ lexptr++;
1648+ return c;
16551649 case '<':
1650+ HANDLE_TOKEN2 ("<=", LEQ, BINOP_END);
1651+ HANDLE_TOKEN2 ("<<", LSH, BINOP_END);
1652+ HANDLE_TOKEN3 ("<<=", ASSIGN_MODIFY, BINOP_LSH);
1653+ lexptr++;
1654+ return c;
16561655 case '>':
1656+ HANDLE_TOKEN2 (">=", GEQ, BINOP_END);
1657+ HANDLE_TOKEN2 (">>", RSH, BINOP_END);
1658+ HANDLE_TOKEN3 (">>=", ASSIGN_MODIFY, BINOP_RSH);
1659+ lexptr++;
1660+ return c;
1661+ case '=':
1662+ HANDLE_TOKEN2 ("==", EQUAL, BINOP_END);
1663+ lexptr++;
1664+ return c;
1665+ case ':':
1666+ HANDLE_TOKEN2 ("::", COLONCOLON, BINOP_END);
1667+ lexptr++;
1668+ return c;
1669+
16571670 case '[':
16581671 case ']':
16591672 case '?':
1660- case ':':
1661- case '=':
1673+ case '@':
1674+ case '~':
16621675 case '{':
16631676 case '}':
16641677 symbol: