Bug 47045 - NetBSD: define changes in ctype.h
Summary: NetBSD: define changes in ctype.h
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: unknown
: P3 normal
Target Milestone: 4.6.0
Assignee: Jonathan Wakely
URL:
Keywords:
Depends on: 47147
Blocks:
  Show dependency treegraph
 
Reported: 2010-12-22 23:54 UTC by Thomas Klausner
Modified: 2019-10-05 15:57 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-12-23 01:41:53


Attachments
check version in config/os/bsd/netbsd/ctype_base.h (606 bytes, patch)
2010-12-23 10:01 UTC, Jonathan Wakely
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Klausner 2010-12-22 23:54:02 UTC
A few days ago, Joerg Sonnenberger improved the name space of NetBSD's ctype.h. He added "_CTYPE" before "_U", "_N", etc.

The commit message can be seen in
http://mail-index.netbsd.org/source-changes/2010/12/14/msg015830.html
the change to ctype_bits.h:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/sys/ctype_bits.h.diff?r1=1.1&r2=1.2&only_with_tag=MAIN
the change to gcc's ctype_base.h as distributed with NetBSD-current:
http://cvsweb.netbsd.org/bsdweb.cgi/src/gnu/dist/gcc4/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h.diff?r1=1.1&r2=1.2&only_with_tag=MAIN

I'd like to see this integrated into one of the next gcc releases.
Since all current releases and older development releases of NetBSD (earlier than 5.99.41) still have _U etc. it's probably a bit harder than just taking the change as above.

I'm not sure how you want to do that exactly.

You can test for the older NetBSD versions with _U etc. with:
#include <sys/param.h>
#if __NetBSD_Version__ < 599004100
...
#endif
Comment 1 Jonathan Wakely 2010-12-23 01:41:53 UTC
should be easy to do, can you test it if I prepare a patch?
Comment 2 Thomas Klausner 2010-12-23 09:35:32 UTC
I can test on 5.99.40 and 5.99.41/amd64. Just send me short instructions how to test. Thanks!
Comment 3 Jonathan Wakely 2010-12-23 10:01:13 UTC
Created attachment 22845 [details]
check version in config/os/bsd/netbsd/ctype_base.h

Does <sys/param.h> get included via <ctype.h> or do I need to include it explicitly?  This patch includes it explicitly.

To test this you'll need to check out svn trunk (or download the gcc-core and gcc-g++ tarballs from a recent snapshot) and apply this patch in the libstdc++-v3 directory, then build the compiler.

Let me know if you need details of how to build the compiler if you don't have the GMP, MPFR and MPC prerequisite libs installed
Comment 4 Jonathan Wakely 2010-12-24 01:32:19 UTC
Building GCC snapshots made easy:
http://advogato.org/person/redi/diary/229.html
Comment 5 Paolo Carlini 2011-01-11 16:27:28 UTC
Are we still waiting for feedback? PS: IMHO, if just <ctype.h> is ok instead of <sys/param.h>, it would be much nicer. Besides that nit, it would be nice to have the tweak in 4.6.0, if we can make it...
Comment 6 Jonathan Wakely 2011-01-11 16:34:31 UTC
GCC 4.6.0 can't be built on NetBSD (PR 47147) so unless that gets fixed there's no way to test the changes, and so I thought no urgency to fix this one

I'm happy to commit the changes untested if you want.

I tried to check the NetBSD CVS repo to find out if ctype.h includes sys/param.h but I couldn't find the right files
Comment 7 Paolo Carlini 2011-01-11 16:46:31 UTC
Ah, I didn't know about 47147. Let's wait a bit more then.
Comment 8 Jonathan Wakely 2011-01-13 00:02:48 UTC
Author: redi
Date: Thu Jan 13 00:02:41 2011
New Revision: 168732

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168732
Log:
2011-01-13  Jonathan Wakely  <jwakely.gcc@gmail.com>

	PR libstdc++/47045
	* config/os/bsd/netbsd/ctype_base.h: Use new macros based on version.


Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h
Comment 9 Jonathan Wakely 2011-01-13 00:05:42 UTC
While testing PR 47147 I was able to verify my patch for this bug allows libstdc++ to build, but I didn't have dejagnu so couldn't run the testsuite.
Should be fixed for 4.6.0
Comment 10 kargls 2019-10-05 15:23:58 UTC
Author: kargl
Date: Sat Oct  5 15:23:26 2019
New Revision: 276627

URL: https://gcc.gnu.org/viewcvs?rev=276627&root=gcc&view=rev
Log:
2019-10-05  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/47045
	* decl.c (variable_decl): Do not search parent namespace for symbol.

2019-10-05  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/47045
	* gfortran.dg/pr47054_1.f90: New test
	* gfortran.dg/pr47054_2.f90: Ditto.

Added:
    trunk/gcc/testsuite/gfortran.dg/pr47054_1.f90
    trunk/gcc/testsuite/gfortran.dg/pr47054_2.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/decl.c
    trunk/gcc/testsuite/ChangeLog
Comment 11 kargls 2019-10-05 15:57:38 UTC
(In reply to kargl from comment #10)
> Author: kargl
> Date: Sat Oct  5 15:23:26 2019
> New Revision: 276627
> 
> URL: https://gcc.gnu.org/viewcvs?rev=276627&root=gcc&view=rev
> Log:
> 2019-10-05  Steven G. Kargl  <kargl@gcc.gnu.org>
> 
> 	PR fortran/47045
> 	* decl.c (variable_decl): Do not search parent namespace for symbol.
> 
> 2019-10-05  Steven G. Kargl  <kargl@gcc.gnu.org>
> 
> 	PR fortran/47045
> 	* gfortran.dg/pr47054_1.f90: New test
> 	* gfortran.dg/pr47054_2.f90: Ditto.
> 

Whoops.  Transposes 47054 to 47045.  Sorry about that.