LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 34330 - error: use of undeclared identifier 'isascii' while compiling strstream.cpp
Summary: error: use of undeclared identifier 'isascii' while compiling strstream.cpp
Status: RESOLVED WONTFIX
Alias: None
Product: libc++
Classification: Unclassified
Component: All Bugs (show other bugs)
Version: 5.0
Hardware: PC other
: P normal
Assignee: Marshall Clow (home)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-25 15:05 PDT by Catherine_Moore
Modified: 2019-02-07 14:18 PST (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments
Build log file with error messages (77.19 KB, text/plain)
2017-08-25 15:05 PDT, Catherine_Moore
Details
-E output part1 (794.30 KB, text/plain)
2017-08-28 08:35 PDT, Catherine_Moore
Details
-E part2 (498.07 KB, text/plain)
2017-08-28 08:35 PDT, Catherine_Moore
Details
newlib's ctype.h (7.69 KB, text/plain)
2017-08-28 08:41 PDT, Catherine_Moore
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Catherine_Moore 2017-08-25 15:05:16 PDT
Created attachment 19043 [details]
Build log file with error messages

I'm running into a problem building libcxx in conjunction with newlib.  The attached log file contains the error messages.
                  ^
The problem appears to be that isascii is referenced in __locale, but the include file cctype doesn't contain a definition.

__locale:        return isascii(__c) ? (__tab_[static_cast<int>(__c)] & __m) !=0 : false;
__locale:            *__vec = isascii(*__low) ? __tab_[static_cast<int>(*__low)] : 0;
__locale:            if (isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))
__locale:            if (!(isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m)))

A definition of isascii can be found in newlib's ctype.h.  What's the best way to fix this?

Thanks,
Catherine
Comment 1 Marshall Clow (home) 2017-08-27 12:18:21 PDT
This is odd.

<__locale> includes <cctype> (line 20), which includes <ctype.h> (line 39)

So you should be getting the definition of isascii. 

Can you run the compile line again, removing the -c and using '-E' instead?
That should give some preprocessed output, and we can see the exact sequence of includes.
Comment 2 Catherine_Moore 2017-08-28 08:35:22 PDT
Created attachment 19053 [details]
-E output part1
Comment 3 Catherine_Moore 2017-08-28 08:35:47 PDT
Created attachment 19054 [details]
-E part2
Comment 4 Catherine_Moore 2017-08-28 08:41:50 PDT
Created attachment 19055 [details]
newlib's ctype.h

After examining the -E output, I see that newlib's ctype.h is picked up.  The isascii declarations are guarded, though:

#if (__MISC_VISIBLE || __XSI_VISIBLE) && !defined _AEABI_PORTABLE
int _EXFUN(isascii, (int __c));
int _EXFUN(toascii, (int __c));
#define _tolower(__c) ((unsigned char)(__c) - 'A' + 'a')
#define _toupper(__c) ((unsigned char)(__c) - 'a' + 'A')
#endif

I don't know whether libcxx's use of isascii ought to be changed or if my defines wrt to newlib are incorrect.  Do you know?

Thanks,
Catherine
Comment 5 Marshall Clow (home) 2017-08-29 09:38:31 PDT
(In reply to Catherine_Moore from comment #4)
> I don't know whether libcxx's use of isascii ought to be changed or if my
> defines wrt to newlib are incorrect.  Do you know?

No; I don't know.  I *suspect* that you should define __MISC_VISIBLE to 1.
But I'm not a Newlib expert, so that's just a guess.
Comment 6 Marshall Clow (home) 2019-02-07 10:13:23 PST
Do you have an update on this?
Is this a newlib problem? (because I can't see anything that libc++ is doing wrong here)
Comment 7 Catherine_Moore 2019-02-07 14:18:13 PST
No, I don't have an update and I'm not currently tracking this problem.  I will close it out and resubmit if we encounter in the future.

Thanks,
Catherine