[ARM] stdint.h should not rely on wchar_t being defined
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
eglibc (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
This patch to eglibc from debian (which is applied for Ubuntu 12.04):
( https:/
Gives this definition for __WCHAR_MAX in bits/wchar.h
#define __WCHAR_MAX ( (wchar_t) - 1 )
This then propagates to WCHAR_MAX from stdint.h:
# define WCHAR_MAX __WCHAR_MAX
The problem is that this introduces a requirement that stddef.h must be included before stdint.h in order to make the definition of wchar_t available.
In a conforming C implimentation, this should be valid:
#include "stdint.h"
#include "stdio.h"
unsigned int
foo (void)
{
return (unsigned int) WCHAR_MAX;
}
Currently this will report:
gcc foo.c
foo.c: In function ‘foo’:
foo.c:7:25: error: ‘wchar_t’ undeclared (first use in this function)
foo.c:7:25: note: each undeclared identifier is reported only once for each function it appears in
The easiest fix would be to take the more modern, portable definition of WCHAR_MAX/
This causes:
FAIL: gcc.dg/ c99-stdint- 1.c (test for excess errors) c99-stdint- 7.c (test for excess errors)
FAIL: gcc.dg/
In the GCC testsuite, when testing a native arm-none- linux-gnueabihf toolchain under a Ubuntu 12.04 system.