Opened 4 years ago

Closed 4 years ago

#346 closed defect (invalid)

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

Reported by: komh 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 komh 4 years ago.
Patch to remove stdint.h from 386/builtin.h

Download all attachments as: .zip

Change History (2)

Changed 4 years ago by komh

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

comment:1 Changed 4 years ago by komh

  • Resolution set to invalid
  • Status changed from new to closed

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.