[
https://issues.apache.org/jira/browse/STDCXX-677?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Travis Vitek updated STDCXX-677:
--------------------------------
Attachment: 8.cstdint.stdcxx-677.cpp
stdcxx-677.patch
In that case, then I don't think that this really needs to be fixed. When the
contents of the `tr1' directory are moved to `include', our stdint.h would get
picked up by the preprocessor before /usr/include/stdint.h. That would
eliminate the problem entirely, unless the user explicitly included
/usr/include/stdint.h
In case you don't agree, I'm providing a patch, test, and description. I wasted
the time writing it, so I might as well show something for my efforts.
{noformat}
2008-01-25 Travis Vitek <[EMAIL PROTECTED]>
STDCXX-677
* include/tr1/cstdint: undefine macros that may have been defined by
system provided stdint.h to prevent name collisions
* etc/config/src/headers.inc: add stdint to the list of headers to test for
at configuration time
* tests/regress/8.cstdint.stdcxx-677.cpp: regression test to verify no
name collision when tr1/cstdint included after stdint.h
{noformat}
> [IBM XLC++ 9.0/AIX 5.3] tr1/cstdint limit macros incompatible with system
> provided C headers
> --------------------------------------------------------------------------------------------
>
> Key: STDCXX-677
> URL: https://issues.apache.org/jira/browse/STDCXX-677
> Project: C++ Standard Library
> Issue Type: Bug
> Components: TR1.8 - C Compatibility
> Affects Versions: 4.2.0
> Reporter: Travis Vitek
> Assignee: Travis Vitek
> Fix For: 4.2.1
>
> Attachments: 8.cstdint.stdcxx-677.cpp, stdcxx-677.patch
>
>
> The following testcase fails to compile because both the C library stdint.h
> and our tr1/cstdint headers define defines the C99 limit macros. It looks
> like we need to avoid defining the macros if a previous definition already
> exists. Is that a sufficient solution? What if our defintion is different for
> some reason?
> {noformat}
> $ cat u.cpp && gmake u
> #include <cstring>
> #include <tr1/cstdint>
> xlCcore -c -I/amd/devco/vitek/stdcxx/trunk/include/ansi -D_RWSTDDEBUG
> -I/amd/devco/vitek/stdcxx/trunk/include -I/build/vitek/11s/include
> -I/amd/devco/vitek/stdcxx/trunk/tests/include -g -qtemplateregistry=u.ti
> u.cpp
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 56.11: 1540-0848
> (S) The macro name "INT8_MAX" is already defined with a different definition.
> "/usr/include/stdint.h", line 142.9: 1540-0425 (I) "INT8_MAX" is defined on
> line 142 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 57.11: 1540-0848
> (S) The macro name "UINT8_MAX" is already defined with a different definition.
> "/usr/include/stdint.h", line 149.9: 1540-0425 (I) "UINT8_MAX" is defined on
> line 149 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 116.11: 1540-0848
> (S) The macro name "INT16_MAX" is already defined with a different definition.
> "/usr/include/stdint.h", line 143.9: 1540-0425 (I) "INT16_MAX" is defined on
> line 143 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 117.11: 1540-0848
> (S) The macro name "UINT16_MAX" is already defined with a different
> definition.
> "/usr/include/stdint.h", line 150.9: 1540-0425 (I) "UINT16_MAX" is defined on
> line 150 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 171.13: 1540-0848
> (S) The macro name "INT32_MAX" is already defined with a different definition.
> "/usr/include/stdint.h", line 144.9: 1540-0425 (I) "INT32_MAX" is defined on
> line 144 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 172.13: 1540-0848
> (S) The macro name "UINT32_MAX" is already defined with a different
> definition.
> "/usr/include/stdint.h", line 151.9: 1540-0425 (I) "UINT32_MAX" is defined on
> line 151 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 225.13: 1540-0848
> (S) The macro name "INT64_MAX" is already defined with a different definition.
> "/usr/include/stdint.h", line 146.9: 1540-0425 (I) "INT64_MAX" is defined on
> line 146 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 226.13: 1540-0848
> (S) The macro name "UINT64_MAX" is already defined with a different
> definition.
> "/usr/include/stdint.h", line 153.9: 1540-0425 (I) "UINT64_MAX" is defined on
> line 153 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 323.9: 1540-0848
> (S) The macro name "PTRDIFF_MIN" is already defined with a different
> definition.
> "/usr/include/stdint.h", line 222.9: 1540-0425 (I) "PTRDIFF_MIN" is defined
> on line 222 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 324.9: 1540-0848
> (S) The macro name "PTRDIFF_MAX" is already defined with a different
> definition.
> "/usr/include/stdint.h", line 223.9: 1540-0425 (I) "PTRDIFF_MAX" is defined
> on line 223 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 326.9: 1540-0848
> (S) The macro name "SIZE_MAX" is already defined with a different definition.
> "/usr/include/stdint.h", line 246.9: 1540-0425 (I) "SIZE_MAX" is defined on
> line 246 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 328.9: 1540-0848
> (S) The macro name "WCHAR_MIN" is already defined with a different definition.
> "/usr/include/stdint.h", line 236.9: 1540-0425 (I) "WCHAR_MIN" is defined on
> line 236 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 329.9: 1540-0848
> (S) The macro name "WCHAR_MAX" is already defined with a different definition.
> "/usr/include/stdint.h", line 234.9: 1540-0425 (I) "WCHAR_MAX" is defined on
> line 234 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 331.9: 1540-0848
> (S) The macro name "WINT_MIN" is already defined with a different definition.
> "/usr/include/stdint.h", line 239.9: 1540-0425 (I) "WINT_MIN" is defined on
> line 239 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 332.9: 1540-0848
> (S) The macro name "WINT_MAX" is already defined with a different definition.
> "/usr/include/stdint.h", line 240.9: 1540-0425 (I) "WINT_MAX" is defined on
> line 240 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 334.9: 1540-0848
> (S) The macro name "SIG_ATOMIC_MIN" is already defined with a different
> definition.
> "/usr/include/stdint.h", line 226.9: 1540-0425 (I) "SIG_ATOMIC_MIN" is
> defined on line 226 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 335.9: 1540-0848
> (S) The macro name "SIG_ATOMIC_MAX" is already defined with a different
> definition.
> "/usr/include/stdint.h", line 227.9: 1540-0425 (I) "SIG_ATOMIC_MAX" is
> defined on line 227 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 339.9: 1540-0848
> (S) The macro name "INT8_MIN" is already defined with a different definition.
> "/usr/include/stdint.h", line 135.9: 1540-0425 (I) "INT8_MIN" is defined on
> line 135 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 340.9: 1540-0848
> (S) The macro name "INT16_MIN" is already defined with a different definition.
> "/usr/include/stdint.h", line 136.9: 1540-0425 (I) "INT16_MIN" is defined on
> line 136 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 341.9: 1540-0848
> (S) The macro name "INT32_MIN" is already defined with a different definition.
> "/usr/include/stdint.h", line 137.9: 1540-0425 (I) "INT32_MIN" is defined on
> line 137 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 342.9: 1540-0848
> (S) The macro name "INT64_MIN" is already defined with a different definition.
> "/usr/include/stdint.h", line 139.9: 1540-0425 (I) "INT64_MIN" is defined on
> line 139 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 344.9: 1540-0848
> (S) The macro name "INT_LEAST8_MIN" is already defined with a different
> definition.
> "/usr/include/stdint.h", line 156.9: 1540-0425 (I) "INT_LEAST8_MIN" is
> defined on line 156 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 345.9: 1540-0848
> (S) The macro name "INT_LEAST16_MIN" is already defined with a different
> definition.
> "/usr/include/stdint.h", line 157.9: 1540-0425 (I) "INT_LEAST16_MIN" is
> defined on line 157 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 346.9: 1540-0848
> (S) The macro name "INT_LEAST32_MIN" is already defined with a different
> definition.
> "/usr/include/stdint.h", line 158.9: 1540-0425 (I) "INT_LEAST32_MIN" is
> defined on line 158 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 347.9: 1540-0848
> (S) The macro name "INT_LEAST64_MIN" is already defined with a different
> definition.
> "/usr/include/stdint.h", line 160.9: 1540-0425 (I) "INT_LEAST64_MIN" is
> defined on line 160 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 349.9: 1540-0848
> (S) The macro name "INT_FAST8_MIN" is already defined with a different
> definition.
> "/usr/include/stdint.h", line 177.9: 1540-0425 (I) "INT_FAST8_MIN" is defined
> on line 177 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 350.9: 1540-0848
> (S) The macro name "INT_FAST16_MIN" is already defined with a different
> definition.
> "/usr/include/stdint.h", line 178.9: 1540-0425 (I) "INT_FAST16_MIN" is
> defined on line 178 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 351.9: 1540-0848
> (S) The macro name "INT_FAST32_MIN" is already defined with a different
> definition.
> "/usr/include/stdint.h", line 179.9: 1540-0425 (I) "INT_FAST32_MIN" is
> defined on line 179 of "/usr/include/stdint.h".
> "/amd/devco/vitek/stdcxx/trunk/include/tr1/cstdint", line 352.9: 1540-0848
> (S) The macro name "INT_FAST64_MIN" is already defined with a different
> definition.
> "/usr/include/stdint.h", line 181.9: 1540-0425 (I) "INT_FAST64_MIN" is
> defined on line 181 of "/usr/include/stdint.h".
> gmake: *** [u.o] Error 1
> $ grep "INT8_MAX" /usr/include/stdint.h
> #define INT8_MAX (127)
> #define UINT8_MAX (255U)
> #define INT_LEAST8_MAX INT8_MAX
> #define UINT_LEAST8_MAX UINT8_MAX
> #define INT_FAST8_MAX INT8_MAX
> #define UINT_FAST8_MAX UINT8_MAX
> $ grep "INT8_MAX" /nfs/devco/vitek/stdcxx/trunk/include/tr1/cstdint
> # define INT8_MAX 127
> # define UINT8_MAX 255U
> # define INT_LEAST8_MAX INT8_MAX
> # define UINT_LEAST8_MAX UINT8_MAX
> # define INT_FAST8_MAX INT8_MAX
> # define UINT_FAST8_MAX UINT8_MAX
> #define INT8_MIN _RWSTD_T_MIN (INT8_MAX)
> $
> {noformat}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.