[openib-general] [PATCH] Fix mstflint compilation with gcc 3.4.2

Tom Duffy tduffy at sun.com
Tue Jan 4 13:00:27 PST 2005


I have just tried to compile mstflint and got the following:

[tduffy at duffman mstflint]$ make
g++ -I. -fno-exceptions -O2 flint.cpp -o mstflint
flint.cpp:537: error: expected `0' before ""
flint.cpp:537: error: invalid initializer for virtual method `virtual bool Flash::CmdSet::write(u_int32_t, void*, int, bool, bool)'
flint.cpp:537: error: expected `;' before ""
flint.cpp:540: error: expected `0' before ""
flint.cpp:540: error: invalid initializer for virtual method `virtual bool Flash::CmdSet::erase_sector(u_int32_t)'
flint.cpp:540: error: expected `;' before ""
flint.cpp:542: error: expected `0' before ""
flint.cpp:542: error: invalid initializer for virtual method `virtual bool Flash::CmdSet::reset()'
flint.cpp:542: error: expected `;' before ""
flint.cpp: In member function `virtual bool Flash::open(const char*)':
flint.cpp:943: error: 'class Flash::CmdSet' has no member named 'reset'
flint.cpp: In member function `bool Flash::erase_sector(u_int32_t)':
flint.cpp:1513: error: 'class Flash::CmdSet' has no member named 'erase_sector'
flint.cpp: In member function `bool Flash::write(u_int32_t, void*, int, bool, bool)':
flint.cpp:1706: error: 'class Flash::CmdSet' has no member named 'write'
make: *** [mstflint] Error 1
[tduffy at duffman mstflint]$ g++ -v
Reading specs from /usr/lib/gcc/x86_64-redhat-linux/3.4.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-languages=c,c++,objc,java,f77 --enable-java-awt=gtk --host=x86_64-redhat-linux
Thread model: posix
gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)

According to Stroustrup's _The_C++_Programming_Language_ Second Edition,
you need to specify pure virtual functions by declaring them "0" rather
than NULL.

This patch fixes that:

Index: svn/trunk/contrib/mellanox/mstflint/flint.cpp
===================================================================
--- svn/trunk/contrib/mellanox/mstflint/flint.cpp	(revision 1468)
+++ svn/trunk/contrib/mellanox/mstflint/flint.cpp	(working copy)
@@ -534,12 +534,12 @@
 				    void*     data, 
 				    int       cnt,
 				    bool      noerase  = false, 
-				    bool      noverify = false)  = NULL;
+				    bool      noverify = false) = 0;
 
 	//virtual bool unlock_bypass (bool      unlock)            = NULL;
-	virtual bool erase_sector  (u_int32_t addr)              = NULL;
+	virtual bool erase_sector  (u_int32_t addr)              = 0;
 
-	virtual bool reset          ()                           = NULL;
+	virtual bool reset          ()                           = 0;
 
     protected:
 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20050104/fa34db9a/attachment.sig>


More information about the general mailing list