ports/112821: [patch] Make x11-wm/fbpager compile with gcc-4.2

Henrik Brix Andersen henrik at brixandersen.dk
Sun May 20 22:00:11 UTC 2007


>Number:         112821
>Category:       ports
>Synopsis:       [patch] Make x11-wm/fbpager compile with gcc-4.2
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun May 20 22:00:10 GMT 2007
>Closed-Date:
>Last-Modified:
>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 at 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:
>Unformatted:



More information about the freebsd-ports-bugs mailing list