Fix errors and warnings from g++-4.4.1 (issue193074)


Blair Zajac <bl...@...>
 

On Jan 23, 2010, at 9:01 PM, chri...@... wrote:

Reviewers: osl-dev_googlegroups.com,

Description:
Several additional warnings and some new errors occur when trying to
compile OSL using g++-4.4.1.

Errors were due to:
- header rearrangements which cause strcmp() and exit() to be
unavaliable without additional includes
- strchr (const char*, char) returns const char*

The warnings are various:
- hash_map is deprecated. The obvious alternative is to use
unordered_map from boost, but it's only avaliable after boost-1.36, so
not sure if my fix will work at SPI :-/
You could do what Google Protocol Buffers does and determine which hash map to use at configure time. It works with g++ 3.4.x all the way up to 4.4.x. See the m4 file at:

http://code.google.com/p/protobuf/source/browse/trunk/m4/stl_hash.m4

Protocol Buffers has a new BSD license so this could be copied straight from them.

Running configure on my Ubuntu Karmic system with g++ 4.4.1 shows

checking the location of hash_map... <tr1/unordered_map>

Regards,
Blair


chri...@...
 

On 2010/01/24 08:26:12, blair wrote:
You could do what Google Protocol Buffers does and determine which
hash map to
use at configure time. It works with g++ 3.4.x all the way up to
4.4.x. See
the m4 file at:
http://code.google.com/p/protobuf/source/browse/trunk/m4/stl_hash.m4
IMHO this seems to be a bit of overkill, and my preferred option would
be just to specify that >=boost-1.36 was necessary. However I know that
may not be an option for everyone so I'll let the OSL core developers
chime in. What's the story guys?

I'll note that using hash_map *does* compile with g++-4.4.1, but not
without warnings (and hence doesn't compile when using -Werror which is
turned on by default in the build scripts).

Protocol Buffers has a new BSD license so this could be copied
straight from
them.
The M4 would have to be converted to cmake, but it's good to see all the
potential places which hash_map may reside. Gosh there's a lot!


http://codereview.appspot.com/193074/show


Wormszer <worm...@...>
 

I too recieved an error from strcmp in oslex.l/cpp when building with visual studio.

Visual studio has not deprecated hash_map from what i can tell, but a boost solution would work there as well.

Does the gcc build really generate no warnings, i guess it must not with the compiler flags to make warnings errors?
I just built oslcomp and I get about 3800 warnings, this is displaying all warnings.

Just picking one example some functions don't have a return in the default switch case, even though the default switch case has a ASSERT macro that calls abort, VS throws a warning.

Jeremy


On Sun, Jan 24, 2010 at 4:28 AM, <chri...@...> wrote:
On 2010/01/24 08:26:12, blair wrote:
You could do what Google Protocol Buffers does and determine which
hash map to
use at configure time.  It works with g++ 3.4.x all the way up to
4.4.x.  See
the m4 file at:

http://code.google.com/p/protobuf/source/browse/trunk/m4/stl_hash.m4

IMHO this seems to be a bit of overkill, and my preferred option would
be just to specify that >=boost-1.36 was necessary.  However I know that
may not be an option for everyone so I'll let the OSL core developers
chime in.  What's the story guys?

I'll note that using hash_map *does* compile with g++-4.4.1, but not
without warnings (and hence doesn't compile when using -Werror which is
turned on by default in the build scripts).


Protocol Buffers has a new BSD license so this could be copied
straight from
them.

The M4 would have to be converted to cmake, but it's good to see all the
potential places which hash_map may reside.  Gosh there's a lot!
--
You received this message because you are subscribed to the Google Groups "OSL Developers" group.
To post to this group, send email to osl...@....
To unsubscribe from this group, send email to osl...@....
For more options, visit this group at http://groups.google.com/group/osl-dev?hl=en.



Wormszer <worm...@...>
 

Actually my error was strchr returning a char* instead of a const char*. osolex.l line# 260


On Sun, Jan 24, 2010 at 3:44 PM, Wormszer <worm...@...> wrote:
I too recieved an error from strcmp in oslex.l/cpp when building with visual studio.

Visual studio has not deprecated hash_map from what i can tell, but a boost solution would work there as well.

Does the gcc build really generate no warnings, i guess it must not with the compiler flags to make warnings errors?
I just built oslcomp and I get about 3800 warnings, this is displaying all warnings.

Just picking one example some functions don't have a return in the default switch case, even though the default switch case has a ASSERT macro that calls abort, VS throws a warning.

Jeremy



On Sun, Jan 24, 2010 at 4:28 AM, <chri...@...> wrote:
On 2010/01/24 08:26:12, blair wrote:
You could do what Google Protocol Buffers does and determine which
hash map to
use at configure time.  It works with g++ 3.4.x all the way up to
4.4.x.  See
the m4 file at:

http://code.google.com/p/protobuf/source/browse/trunk/m4/stl_hash.m4

IMHO this seems to be a bit of overkill, and my preferred option would
be just to specify that >=boost-1.36 was necessary.  However I know that
may not be an option for everyone so I'll let the OSL core developers
chime in.  What's the story guys?

I'll note that using hash_map *does* compile with g++-4.4.1, but not
without warnings (and hence doesn't compile when using -Werror which is
turned on by default in the build scripts).


Protocol Buffers has a new BSD license so this could be copied
straight from
them.

The M4 would have to be converted to cmake, but it's good to see all the
potential places which hash_map may reside.  Gosh there's a lot!
--
You received this message because you are subscribed to the Google Groups "OSL Developers" group.
To post to this group, send email to osl...@....
To unsubscribe from this group, send email to osl...@....
For more options, visit this group at http://groups.google.com/group/osl-dev?hl=en.




Chris Foster <chri...@...>
 

On Mon, Jan 25, 2010 at 7:02 AM, Wormszer <worm...@...> wrote:
Actually my error was strchr returning a char* instead of a const char*.
osolex.l line# 260
Yeah, I believe that's fixed in the patch.

On Sun, Jan 24, 2010 at 3:44 PM, Wormszer <worm...@...> wrote:

I too recieved an error from strcmp in oslex.l/cpp when building with
visual studio.

Visual studio has not deprecated hash_map from what i can tell, but a
boost solution would work there as well.
From what I can tell, the latest visual studio has a native
unordered_map implementation, but my preference for boost is just
because it's consistent across all platforms.

Does the gcc build really generate no warnings, i guess it must not with
the compiler flags to make warnings errors?
Yep.

I just built oslcomp and I get about 3800 warnings, this is displaying all
warnings.
This is to be expected really; all the different compilers have
somewhat different ways of checking for suspicious code, and the
compiler authors have different standards about what they consider
"suspicious" ;-)

~Chris