From brix@lothlorien.brixandersen.dk  Sun May 20 21:53:50 2007
Return-Path: <brix@lothlorien.brixandersen.dk>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id DBC3316A41F
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 20 May 2007 21:53:50 +0000 (UTC)
	(envelope-from brix@lothlorien.brixandersen.dk)
Received: from solow.pil.dk (relay.pil.dk [195.41.47.164])
	by mx1.freebsd.org (Postfix) with ESMTP id 660D513C46E
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 20 May 2007 21:53:50 +0000 (UTC)
	(envelope-from brix@lothlorien.brixandersen.dk)
Received: from lothlorien.brixandersen.dk (osgiliath.brixandersen.dk [87.53.223.189])
	by solow.pil.dk (Postfix) with ESMTP id 863601CC0F0;
	Sun, 20 May 2007 23:53:49 +0200 (CEST)
Received: by lothlorien.brixandersen.dk (Postfix, from userid 1001)
	id EC85B11420; Sun, 20 May 2007 23:53:48 +0200 (CEST)
Message-Id: <20070520215348.EC85B11420@lothlorien.brixandersen.dk>
Date: Sun, 20 May 2007 23:53:48 +0200 (CEST)
From: Henrik Brix Andersen <henrik@brixandersen.dk>
Reply-To: Henrik Brix Andersen <henrik@brixandersen.dk>
To: FreeBSD-gnats-submit@freebsd.org
Cc: novel@FreeBSD.org
Subject: [patch] Make x11-wm/fbpager compile with gcc-4.2
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         112821
>Category:       ports
>Synopsis:       [patch] Make x11-wm/fbpager compile with gcc-4.2
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    novel
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun May 20 22:00:10 GMT 2007
>Closed-Date:    Sun Jun 17 05:44:53 GMT 2007
>Last-Modified:  Sun Jun 17 05:50:04 GMT 2007
>Originator:     Henrik Brix Andersen
>Release:        FreeBSD 7.0-CURRENT i386
>Organization:
pil.dk
>Environment:
System: FreeBSD lothlorien.brixandersen.dk 7.0-CURRENT FreeBSD 7.0-CURRENT #34: Sun May 20 13:14:49 CEST 2007 root@lothlorien.brixandersen.dk:/usr/obj/usr/src/sys/LOTHLORIEN i386


	
>Description:
Currently, x11-wm/fbpager doesn't compile with gcc-4.2 as found in
recent -CURRENT:

source='main.cc' object='fbpager-main.o' libtool=no  depfile='.deps/fbpager-main.Po' tmpdepfile='.deps/fbpager-main.TPo'  depmo
de=gcc3 /bin/sh ../depcomp  c++ -DHAVE_CONFIG_H -I. -I. -I..    -IFbTk -O2 -fno-strict-aliasing -pipe -march=prescott  -I/usr/l
ocal/include -c -o fbpager-main.o `test -f main.cc || echo './'`main.cc
source='FbPager.cc' object='fbpager-FbPager.o' libtool=no  depfile='.deps/fbpager-FbPager.Po' tmpdepfile='.deps/fbpager-FbPager
.TPo'  depmode=gcc3 /bin/sh ../depcomp  c++ -DHAVE_CONFIG_H -I. -I. -I..    -IFbTk -O2 -fno-strict-aliasing -pipe -march=presco
tt  -I/usr/local/include -c -o fbpager-FbPager.o `test -f FbPager.cc || echo './'`FbPager.cc
In file included from FbPager.cc:40:
Resources.hh:13: error: specialization of 'void FbTk::Resource<T>::setFromString(const char*) [with T = bool]' in different nam
espace
Resources.hh:13: error:   from definition of 'void FbTk::Resource<T>::setFromString(const char*) [with T = bool]'
Resources.hh:23: error: specialization of 'std::string FbTk::Resource<T>::getString() [with T = bool]' in different namespace
Resources.hh:23: error:   from definition of 'std::string FbTk::Resource<T>::getString() [with T = bool]'
Resources.hh:28: error: specialization of 'void FbTk::Resource<T>::setFromString(const char*) [with T = std::basic_string<char,
 std::char_traits<char>, std::allocator<char> >]' in different namespace
Resources.hh:28: error:   from definition of 'void FbTk::Resource<T>::setFromString(const char*) [with T = std::basic_string<ch
ar, std::char_traits<char>, std::allocator<char> >]'
Resources.hh:33: error: specialization of 'std::string FbTk::Resource<T>::getString() [with T = std::basic_string<char, std::ch
ar_traits<char>, std::allocator<char> >]' in different namespace
Resources.hh:33: error:   from definition of 'std::string FbTk::Resource<T>::getString() [with T = std::basic_string<char, std:
:char_traits<char>, std::allocator<char> >]'
Resources.hh:38: error: specialization of 'void FbTk::Resource<T>::setFromString(const char*) [with T = int]' in different name
space
Resources.hh:38: error:   from definition of 'void FbTk::Resource<T>::setFromString(const char*) [with T = int]'
Resources.hh:45: error: specialization of 'std::string FbTk::Resource<T>::getString() [with T = int]' in different namespace
Resources.hh:45: error:   from definition of 'std::string FbTk::Resource<T>::getString() [with T = int]'
Resources.hh:53: error: specialization of 'void FbTk::Resource<T>::setFromString(const char*) [with T = FbPager::FbPager::Align
ment]' in different namespace
Resources.hh:53: error:   from definition of 'void FbTk::Resource<T>::setFromString(const char*) [with T = FbPager::FbPager::Al
ignment]'
Resources.hh:61: error: specialization of 'std::string FbTk::Resource<T>::getString() [with T = FbPager::FbPager::Alignment]' i
n different namespace
Resources.hh:61: error:   from definition of 'std::string FbTk::Resource<T>::getString() [with T = FbPager::FbPager::Alignment]
'
FbPager.cc: In constructor 'FbPager::FbPager::FbPager(int, bool, bool, bool, bool, const char*)':
FbPager.cc:271: warning: deprecated conversion from string constant to 'char*'
FbPager.cc:277: warning: deprecated conversion from string constant to 'char*'
FbPager.cc:278: warning: deprecated conversion from string constant to 'char*'
*** Error code 1


	
>How-To-Repeat:
On a -CURRENT box with gcc-4.2:

# cd /usr/ports/x11-wm/fbpager
# make

	
>Fix:
The patch below was taken from Gentoo Linux Bugzilla, originally
submitted by Ryan Hill. See http://bugs.gentoo.org/135504

It fixes the build with gcc-4.2 for me.

	

--- patch-Resources.hh begins here ---
--- src/Resources.hh
+++ src/Resources.hh
@@ -8,8 +8,10 @@
 #include <cstdio>
 #include <cstring>
 
+namespace FbTk {
+
 template<>
-void FbTk::Resource<bool>::
+void Resource<bool>::
 setFromString(char const *strval) {
     if (strcasecmp(strval, "true") == 0 ||
         strcasecmp(strval, "yes") == 0)
@@ -19,38 +21,37 @@
 }
 
 template<>
-std::string FbTk::Resource<bool>::
+std::string Resource<bool>::
 getString() {				
     return std::string(**this == true ? "true" : "false");
 }
 
 template <>
-void FbTk::Resource<std::string>::setFromString(const char *str) {
+void Resource<std::string>::setFromString(const char *str) {
     *(*this) = (str ?  str : "");
 }
 
 template <>
-std::string FbTk::Resource<std::string>::getString() {
+std::string Resource<std::string>::getString() {
     return *(*this);
 }
 
 template <>
-void FbTk::Resource<int>::setFromString(const char *str) {
+void Resource<int>::setFromString(const char *str) {
     if (str == 0)
         return;
     sscanf(str, "%d", &(*(*this)));
 }
 
 template <>
-std::string FbTk::Resource<int>::getString() {
+std::string Resource<int>::getString() {
     char buff[16];
     sprintf(buff, "%d", (*(*this)));
     return std::string(buff);
 }
 
-namespace FbPager {
 template <>
-void FbTk::Resource<FbPager::Alignment>::setFromString(const char *str) {
+void Resource<FbPager::FbPager::Alignment>::setFromString(const char *str) {
     if (strcmp("TopToBottom", str) == 0)
         *(*this) = FbPager::FbPager::TOP_TO_BOTTOM;
     else
@@ -58,7 +59,7 @@
 }
 
 template <>
-std::string FbTk::Resource<FbPager::Alignment>::getString() {
+std::string Resource<FbPager::FbPager::Alignment>::getString() {
     switch (*(*this)) {
     case FbPager::FbPager::LEFT_TO_RIGHT:
         return "LeftToRight";
@@ -67,6 +68,6 @@
     }
 }
 
-} // end namespace FbPager
+} // end namespace FbTk
 
 #endif // RESOURCES
--- patch-Resources.hh ends here ---


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->novel 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Sun May 20 22:00:17 UTC 2007 
Responsible-Changed-Why:  
Over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=112821 
State-Changed-From-To: open->closed 
State-Changed-By: novel 
State-Changed-When: Sun Jun 17 05:44:51 UTC 2007 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=112821 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/112821: commit references a PR
Date: Sun, 17 Jun 2007 05:43:15 +0000 (UTC)

 novel       2007-06-17 05:43:08 UTC
 
   FreeBSD ports repository
 
   Added files:
     x11-wm/fbpager/files patch-Resources.hh 
   Log:
   Fix build with gcc42.
   
   PR:             112821
   Submitted by:   Henrik Brix Andersen <henrik@brixandersen.dk>
   Obtained from:  Gentoo Linux Bugzilla (bug 135504)
   
   Revision  Changes    Path
   1.1       +76 -0     ports/x11-wm/fbpager/files/patch-Resources.hh (new)
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
