stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Travis Vitek (JIRA)" <j...@apache.org>
Subject [jira] Commented: (STDCXX-436) [Linux] MB_LEN_MAX incorrect
Date Fri, 07 Sep 2007 21:07:31 GMT

    [ https://issues.apache.org/jira/browse/STDCXX-436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12525833
] 

Travis Vitek commented on STDCXX-436:
-------------------------------------

I have one comment on this. Here is a quick summary of the problem.

  1. t.cpp includes <limits.h> which is actually our include/ansi/limits.h
  2. include/ansi/limits.h includes the gcc modified limits.h
  3. gcc modified limits.h attempts to use #include_next to include /usr/include/limits.h,
but this actually gets include/ansi/limits.h again, which is a no-op because of the header
guards.

The following is evidence of the include issue...

  [vitek@robot] 623 % cat t.cpp
  #include <limits.h>
  int main() { return 0; }

  [vitek@robot] 623 % g++ -H t.cpp
  . /amd/packages/mdx/redhat/em64t/compilers/gcc/3.4.6-3/bin/../lib/gcc/x86_64-redhat-linux/3.4.6/include/limits.h
  .. /amd/packages/mdx/redhat/em64t/compilers/gcc/3.4.6-3/bin/../lib/gcc/x86_64-redhat-linux/3.4.6/include/syslimits.h
  ... /amd/packages/mdx/redhat/em64t/compilers/gcc/3.4.6-3/bin/../lib/gcc/x86_64-redhat-linux/3.4.6/include/limits.h
  .... /usr/include/limits.h
  ..... /usr/include/features.h
  ...... /usr/include/sys/cdefs.h
  ...... /usr/include/gnu/stubs.h
  ..... /usr/include/bits/posix1_lim.h
  ...... /usr/include/bits/local_lim.h
  ....... /usr/include/linux/limits.h
  ..... /usr/include/bits/posix2_lim.h
  ..... /usr/include/bits/xopen_lim.h
  ...... /usr/include/bits/stdio_lim.h

  [vitek@robot] 624 % gmake CPPOPTS="-H" t
  gcc -c -I/amd/devco/vitek/stdcxx/trunk/include/ansi -D_RWSTDDEBUG   -pthread -I/amd/devco/vitek/stdcxx/trunk/include
-I/nfs/devbuild/vitek/stdcxx/gcc-346/2007-09-07/include -I/amd/devco/vitek/stdcxx/trunk/tests/include
-H -pedantic -nostdinc++ -g  -W -Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long
-Wcast-align  t.cpp
  . /amd/devco/vitek/stdcxx/trunk/include/ansi/limits.h
  .. /amd/devco/vitek/stdcxx/trunk/include/rw/_defs.h
  ... /amd/devco/vitek/stdcxx/trunk/include/rw/_config.h
  .... /nfs/devbuild/vitek/stdcxx/gcc-346/2007-09-07/include/config.h
  .... /amd/devco/vitek/stdcxx/trunk/include/rw/_config-gcc.h
  .. /amd/packages/mdx/redhat/em64t/compilers/gcc/3.4.6-3/bin/../lib/gcc/x86_64-redhat-linux/3.4.6/include/../include/limits.h
  ... /amd/packages/mdx/redhat/em64t/compilers/gcc/3.4.6-3/bin/../lib/gcc/x86_64-redhat-linux/3.4.6/include/../include/syslimits.h
  .... /amd/devco/vitek/stdcxx/trunk/include/ansi/limits.h

So the problem that I see with the workaround for this issue is that anything included from
/usr/include/limits.h is not seen when building using our headers. This would cause problems
for a user program that depends on macros, functions, or types declared to be included from
/usr/include/limits.h such as this one, 

#include <limits.h>
int main ()
{
    char host [HOST_NAME_MAX];
    return 0;
}

> [Linux] MB_LEN_MAX incorrect
> ----------------------------
>
>                 Key: STDCXX-436
>                 URL: https://issues.apache.org/jira/browse/STDCXX-436
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 18. Language Support
>    Affects Versions: 4.1.3
>         Environment: gcc version 4.1.1 20070105 (Red Hat 4.1.1-51)
>            Reporter: Mark Brown
>            Assignee: Travis Vitek
>            Priority: Critical
>             Fix For: 4.2
>
>         Attachments: stdcxx-436.patch
>
>
> On my Linux system MB_LEN_MAX is normally defined to 16 but when I use the macro in a
program compiled with stdcxx the macro evaluates to 1. The test case goes like this:
> $ cat test.cpp && make CPPOPTS="-DGETCONF_MB_LEN_MAX=`getconf MB_LEN_MAX`" test
&& ./test
> #include <assert.h>
> #include <limits.h>
> int main ()
> {
>     assert (MB_LEN_MAX == GETCONF_MB_LEN_MAX);
> }
> gcc -c -I/home/mbrown/stdcxx/include/ansi -D_RWSTDDEBUG    -I/home/mbrown/stdcxx/include
-I/home/mbrown/stdcxx-gcc-4.1.1-11s/include -I/home/mbrown/stdcxx/examples/include -DGETCONF_MB_LEN_MAX=16
-pedantic -nostdinc++ -g  -W -Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long
-Wcast-align   test.cpp
> gcc u.o -o u  -L/home/mbrown/stdcxx-gcc-4.1.1-11s/lib  -lstd11s -lsupc++ -lm 
> test: test.cpp:6: int main(): Assertion `1 == 16' failed.
> Aborted

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message