alekseyd / sparsehash

Automatically exported from code.google.com/p/sparsehash
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Compilation fails on HP-UX aCC compiler #51

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Compile the following code on aCC: HP ANSI C++ B3910B A.03.77

#include "google/dense_hash_map"

// one that performs particularly well is the Jenkins One-at-a-time hash,
adapted here from an article by Bob Jenkins, its creator.
inline int joaat_hash( const char * key, int len )
{
    int hash = 0;
    for( int i = 0; i < len; ++i )
    {
        hash += (unsigned char) key[i];
        hash += (hash << 10);
        hash ^= (hash >> 6);
    }
    hash += (hash << 3);
    hash ^= (hash >> 11);
    hash += (hash << 15);
    return hash;
}

template<class T> struct my_hash
{
  size_t operator()( const std::string& x ) const
  {
    return joaat_hash( x.c_str(), x.length() );
  }
};

void test_func()
{
  typedef google::dense_hash_map<std::string, std::string,
my_hash<std::string> > gmap;
  gmap gm;
}

What is the expected output? What do you see instead?

Error 219:
"/tmp_mnt/export/home/andrews/dev/head/common/Cpp/Infrastructure/SysUtils/src/ma
in/Inc/google/sparsehash/densehashtable.h",
line 665 # Cannot return value where return type of function is void.
          return resize_delta(req_elements - num_elements);
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
Error 219:
"/tmp_mnt/export/home/andrews/dev/head/common/Cpp/Infrastructure/SysUtils/src/ma
in/Inc/google/dense_hash_map",
line 240 # Cannot return value where return type of function is void.
        return rep.set_resizing_parameters(shrink, grow);
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 

What version of the product are you using? On what operating system?

The last version 1.6 on HP-UX B.11.11 U 9000/800 4231049643

Please provide any additional information below.

It looks like an error - there is a void function attempting to return a
value. Strange that it was not triggered by other compilers - it compiled
just fine on SunOS/AIX/Linux.

Original issue reported on code.google.com by ascheti...@gmail.com on 15 Feb 2010 at 1:56

GoogleCodeExporter commented 9 years ago
Same problem in 

Error 219: "Inc/google/sparse_hash_map", line 227 # Cannot return value where 
return
type of function is void.
        return rep.set_resizing_parameters(shrink, grow);
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 

Original comment by ascheti...@gmail.com on 15 Feb 2010 at 4:02

GoogleCodeExporter commented 9 years ago
Thanks for the pointer.  I'll fix this for the next release.

} Strange that it was not triggered by other compilers

gcc, at least, has an extension that allows one to return 'void'.

Original comment by csilv...@gmail.com on 18 Feb 2010 at 11:23

GoogleCodeExporter commented 9 years ago
This should be fixed in sparsehash 1.7, just released.

Original comment by csilv...@gmail.com on 3 Apr 2010 at 1:22