Opened 9 years ago

Closed 8 years ago

#346 closed defect (invalid)

Do not include stdint.h in 386/builtin.h

Reported by: KO Myung-Hun Owned by:
Priority: normal Milestone: libc-0.7
Component: libc Version: 0.6.6
Severity: normal Keywords:
Cc:

Description

Hi/2.

386/builtin.h includes stdint.h. This may not be a problem on C, however this may be a problem on C++. Because, stdint.h does not define some macros such as INT64_C() on C++ by default. It needs some macros such as __STDC_CONSTANT_MACROS are declared.

So if stdint.h is included once without macro declaration on C++, later macros such as INT64_C() are not declares even if stdint.h is included explicitly.

For example,

#include <vector>
#include <iostream>

#define __STDC_CONSTANT_MACROS
#include <stdint.h>

int main()
{
    std::cout << INT64_C(0) << "\n";

    return 0;
}

This fails.

vector.cpp: In function `int main()':
vector.cpp:9: error: `INT64_C' undeclared (first use this function)
vector.cpp:9: error: (Each undeclared identifier is reported only once for each 
   function it appears in.)

However, this succeeds on other platforms such as mingw-482.

Attachments (1)

builtin.diff (4.4 KB) - added by KO Myung-Hun 9 years ago.
Patch to remove stdint.h from 386/builtin.h

Download all attachments as: .zip

Change History (2)

Changed 9 years ago by KO Myung-Hun

Attachment: builtin.diff added

Patch to remove stdint.h from 386/builtin.h

comment:1 Changed 8 years ago by KO Myung-Hun

Resolution: invalid
Status: newclosed

This is not a problem of 386/builtin.h including stdint.h, but of C++11 support.

See ticket:297#comment:1.

Note: See TracTickets for help on using tickets.