ext/stl_hashtable.h:313 - computed value not used (source included)
Dylan Cuthbert
dylan@q-games.com
Tue Mar 19 21:50:00 GMT 2002
The attached file has the code that causes the warnings:
compile with "g++ -D __gnu_cxx=std -Wall -Werror testhash.cpp"
The output I get is:
$ g++ -Wall -Werror -D __gnu_cxx=std hashtest.cpp
cc1plus.exe: warnings being treated as errors
/usr/local/include/g++-v3/ext/stl_hashtable.h: In member function
`std::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>&
std::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey,
_Alloc>::operator=(const std::hashtable<_Val, _Key, _HashFcn,
_ExtractKey,
_EqualKey, _Alloc>&) [with _Val = std::pair<const char* const, STD_INT>,
_Key = const char*, _HashFcn = std::hash<const char*>, _ExtractKey =
std::_Select1st<std::pair<const char* const, STD_INT> >, _EqualKey =
NameIDMap::eqstr, _Alloc = std::allocator<STD_4BYTE>]':
/usr/local/include/g++-v3/ext/stl_hashtable.h:317: warning: value computed
is
not used
/usr/local/include/g++-v3/ext/stl_hashtable.h:318: warning: value computed
is
not used
/usr/local/include/g++-v3/ext/stl_hashtable.h:319: warning: value computed
is
not used
/usr/local/include/g++-v3/ext/stl_hashtable.h: In member function
`std::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>&
std::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey,
_Alloc>::operator=(const std::hashtable<_Val, _Key, _HashFcn,
_ExtractKey,
_EqualKey, _Alloc>&) [with _Val = std::pair<const STD_INT, std::string>,
_Key = STD_INT, _HashFcn = std::hash<int>, _ExtractKey =
std::_Select1st<std::pair<const STD_INT, std::string> >, _EqualKey =
std::equal_to<STD_INT>, _Alloc = std::allocator<std::string>]':
/usr/local/include/g++-v3/ext/stl_hashtable.h:317: warning: value computed
is
not used
/usr/local/include/g++-v3/ext/stl_hashtable.h:318: warning: value computed
is
not used
/usr/local/include/g++-v3/ext/stl_hashtable.h:319: warning: value computed
is
not used
g++ --version gives :
g++ (GCC) 3.1 20020311 (prerelease)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Is this significantly different to the 20020317 version you mentioned you
were using?
Regards
---------------------------------
Q-Games, Dylan Cuthbert.
http://www.q-games.com
----- Original Message -----
From: "Paolo Carlini" <pcarlini@unitus.it>
To: <dylan@q-games.com>
Cc: <gcc-help@gcc.gnu.org>
Sent: Tuesday, March 19, 2002 3:45 AM
Subject: Re: ext/stl_hashtable.h:313 - computed value not used + question
regarding __gnu_cxx
> Hi,
>
> > I get warnings from including ext/hash_map extended stl libraries.. the
> > warning occurs in ext/stl_hashtable.h:313
>
> Can you please be more specific (i.e., code snippet triggering the
warning, 3.1
> snapshot you are testing, etc.) ??
>
> With 3.1 20020317 I can compile -Wall -Werror the example below with no
warnings
> at all.
>
> Thanks,
> Paolo.
>
> ///////////////
>
> #include <ext/hash_map>
> #include <iostream>
>
> using namespace __gnu_cxx;
> using namespace std;
>
> struct eqstr
> {
> bool operator()(const char* s1, const char* s2) const
> {
> return strcmp(s1, s2) == 0;
> }
> };
>
> int main()
> {
> hash_map<const char*, int, hash<const char*>, eqstr> months;
>
> months["january"] = 31;
> months["february"] = 28;
> months["march"] = 31;
> months["april"] = 30;
> months["may"] = 31;
> months["june"] = 30;
> months["july"] = 31;
> months["august"] = 31;
> months["september"] = 30;
> months["october"] = 31;
> months["november"] = 30;
> months["december"] = 31;
>
> cout << "september -> " << months["september"] << endl;
> cout << "april -> " << months["april"] << endl;
> cout << "june -> " << months["june"] << endl;
> cout << "november -> " << months["november"] << endl;
> }
>
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hashtest.cpp
Type: application/octet-stream
Size: 2176 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20020319/854ef27f/attachment.obj>
More information about the Gcc-help
mailing list