Skip to content

Commit 28f6846

Browse files
committed
Remove isdigit macro redefs, replace with __isdigit_a
Changes here remove the redefinition of isdigit() in the a2e ctype.h headers. In order to fully make this work functionally, the references/usages of isdigit() are replaced with __isdigit_a() to properly recognize ascii digit literals. Signed-off-by: Gaurav Chaudhari <[email protected]>
1 parent 0e4ad4c commit 28f6846

File tree

8 files changed

+19
-67
lines changed

8 files changed

+19
-67
lines changed

compiler/control/OMROptions.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0
2020
*******************************************************************************/
2121

22+
#define _AE_BIMODAL
23+
2224
#include "control/Options.hpp"
2325
#include "control/OptionsUtil.hpp"
2426
#include "control/Options_inlines.hpp"
@@ -1376,7 +1378,7 @@ OMR::Options::getNumericValue(const char *& option)
13761378
while (pendingOperation)
13771379
{
13781380
int64_t current = 0;
1379-
while (isdigit(*option))
1381+
while (__isdigit_a(*option))
13801382
{
13811383
current = 10 * current + *option - '0';
13821384
option++;
@@ -3426,7 +3428,7 @@ OMR::Options::processOptionSet(
34263428
options++;
34273429
//assume this is a digit
34283430
value=0;
3429-
while (isdigit(*options))
3431+
while (__isdigit_a(*options))
34303432
{
34313433
value = 10 * value + *options - '0';
34323434
options++;
@@ -3443,7 +3445,7 @@ OMR::Options::processOptionSet(
34433445
options++;
34443446
//assume this is a digit
34453447
value=0;
3446-
while (isdigit(*options))
3448+
while (__isdigit_a(*options))
34473449
{
34483450
value = 10*value + *options - '0';
34493451
options++;
@@ -4390,10 +4392,10 @@ OMR::Options::setCounts()
43904392
{
43914393
while (s[0] == ' ')
43924394
++s;
4393-
if (isdigit(s[0]))
4395+
if (__isdigit_a(s[0]))
43944396
{
43954397
count[i] = atoi(s);
4396-
while(isdigit(s[0]))
4398+
while(__isdigit_a(s[0]))
43974399
++s;
43984400
if (initialCount >= 0)
43994401
{
@@ -4415,10 +4417,10 @@ OMR::Options::setCounts()
44154417
count[i] = -1;
44164418
while (s[0] == ' ')
44174419
++s;
4418-
if (isdigit(s[0]))
4420+
if (__isdigit_a(s[0]))
44194421
{
44204422
bcount[i] = atoi(s);
4421-
while(isdigit(s[0]))
4423+
while(__isdigit_a(s[0]))
44224424
++s;
44234425
if (initialBCount >= 0)
44244426
{
@@ -4438,10 +4440,10 @@ OMR::Options::setCounts()
44384440
bcount[i] = -1;
44394441
while (s[0] == ' ')
44404442
++s;
4441-
if (isdigit(s[0]))
4443+
if (__isdigit_a(s[0]))
44424444
{
44434445
milcount[i] = atoi(s);
4444-
while(isdigit(s[0]))
4446+
while(__isdigit_a(s[0]))
44454447
++s;
44464448
if (initialMILCount >= 0)
44474449
{

compiler/ras/LimitFile.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0
2020
*******************************************************************************/
2121

22+
#define _AE_BIMODAL
23+
2224
#include <ctype.h>
2325
#include <limits.h>
2426
#include <stddef.h>
@@ -544,10 +546,10 @@ TR_Debug::limitfileOption(const char *option, void *base, TR::OptionTable *entry
544546
}
545547

546548
int32_t randNum;
547-
while (isdigit(p[0]))
549+
while (__isdigit_a(p[0]))
548550
{
549551
randNum = atoi(p);
550-
while(isdigit(p[0]))
552+
while(__isdigit_a(p[0]))
551553
++p;
552554

553555
if (isNegative)

ddr/include/ddr/std/sstream.hpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,8 @@
2525
#include "ddr/config.hpp"
2626

2727
#if defined(J9ZOS390)
28-
2928
#include <ctype.h>
30-
#undef toupper
31-
#undef tolower
32-
33-
#include <sstream>
34-
35-
#define toupper(c) (islower(c) ? (c & _XUPPER_ASCII) : c)
36-
#define tolower(c) (isupper(c) ? (c | _XLOWER_ASCII) : c)
37-
38-
#else /* defined(J9ZOS390) */
39-
#include <sstream>
4029
#endif /* defined(J9ZOS390) */
4130

31+
#include <sstream>
4232
#endif /* SSTREAM_HPP */

ddr/include/ddr/std/string.hpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,8 @@
2525
#include "ddr/config.hpp"
2626

2727
#if defined(J9ZOS390)
28-
2928
#include <ctype.h>
30-
#undef toupper
31-
#undef tolower
32-
33-
#include <string>
34-
35-
#define toupper(c) (islower(c) ? (c & _XUPPER_ASCII) : c)
36-
#define tolower(c) (isupper(c) ? (c | _XLOWER_ASCII) : c)
37-
38-
#else /* defined(J9ZOS390) */
39-
#include <string>
4029
#endif /* defined(J9ZOS390) */
4130

31+
#include <string>
4232
#endif /* STRING_HPP */

ddr/include/ddr/std/unordered_map.hpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626

2727
#if defined(J9ZOS390)
2828
#include <ctype.h>
29-
#undef toupper
30-
#undef tolower
3129
#endif /* defined(J9ZOS390) */
3230

3331
#include <unordered_map>
@@ -38,9 +36,4 @@ using std::unordered_map;
3836
using std::tr1::unordered_map;
3937
#endif /* defined(OMR_HAVE_CXX11) */
4038

41-
#if defined(J9ZOS390)
42-
#define toupper(c) (islower(c) ? (c & _XUPPER_ASCII) : c)
43-
#define tolower(c) (isupper(c) ? (c | _XLOWER_ASCII) : c)
44-
#endif /* defined(J9ZOS390) */
45-
4639
#endif /* DDR_UNORDERED_MAP */

fvtest/omrGtestGlue/omrGtest.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,5 @@
2626
* So we explicitly include <ctype.h> and undefine the macros for gtest, after gtest we then define back the macros.
2727
*/
2828
#include <ctype.h>
29-
#if defined(J9ZOS390) && !defined(OMR_EBCDIC)
30-
#undef toupper
31-
#undef tolower
3229

33-
#include "gtest-all.cc"
34-
35-
#define toupper(c) (islower(c) ? (c & _XUPPER_ASCII) : c)
36-
#define tolower(c) (isupper(c) ? (c | _XLOWER_ASCII) : c)
37-
38-
#else
39-
#include "gtest-all.cc"
40-
#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */
30+
#include "gtest-all.cc"

fvtest/omrGtestGlue/omrTest.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,9 @@ static int iconv_init_static_variable = iconv_initialization();
3737
* So we explicitly include <ctype.h> and undefine the macros for gtest, after gtest we then define back the macros.
3838
*/
3939
#include <ctype.h>
40-
#undef toupper
41-
#undef tolower
42-
43-
#include "gtest/gtest.h"
44-
45-
#define toupper(c) (islower(c) ? (c & _XUPPER_ASCII) : c)
46-
#define tolower(c) (isupper(c) ? (c | _XLOWER_ASCII) : c)
40+
#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */
4741

48-
#else
4942
#include "gtest/gtest.h"
50-
#endif /* defined(J9ZOS390) && !defined(OMR_EBCDIC) */
5143

5244
using namespace testing;
5345

util/a2e/headers/ctype.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@
8080
#define isalnum(c) (_IN_RANGE(c) ? (_ascii_is_tab[c] & _ISALNUM_ASCII) : 0)
8181
#define isalpha(c) (_IN_RANGE(c) ? (_ascii_is_tab[c] & _ISALPHA_ASCII) : 0)
8282
#define iscntrl(c) (_IN_RANGE(c) ? (_ascii_is_tab[c] & _ISCNTRL_ASCII) : 0)
83-
#define isdigit(c) (_IN_RANGE(c) ? (_ascii_is_tab[c] & _ISDIGIT_ASCII) : 0)
8483
#define isgraph(c) (_IN_RANGE(c) ? (_ascii_is_tab[c] & _ISGRAPH_ASCII) : 0)
8584
#define islower(c) (_IN_RANGE(c) ? (_ascii_is_tab[c] & _ISLOWER_ASCII) : 0)
8685
#define isprint(c) (_IN_RANGE(c) ? (_ascii_is_tab[c] & _ISPRINT_ASCII) : 0)
@@ -89,12 +88,6 @@
8988
#define isupper(c) (_IN_RANGE(c) ? (_ascii_is_tab[c] & _ISUPPER_ASCII) : 0)
9089
#define isxdigit(c) (_IN_RANGE(c) ? (_ascii_is_tab[c] & _ISXDIGIT_ASCII) : 0)
9190

92-
/*
93-
* In ASCII, upper case characters have the bit off ibm@4345
94-
*/
95-
#define toupper(c) (islower(c) ? (c & _XUPPER_ASCII) : c)
96-
#define tolower(c) (isupper(c) ? (c | _XLOWER_ASCII) : c)
97-
9891
#endif
9992

10093
#endif

0 commit comments

Comments
 (0)