- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is a warning that does not get emitted by default (you must be using -w1 or greater).
Below is an example of when it would be emitted. The compiler sees that commit() member function is declared/defined inside an unnamed namespace. Thus the only place it can ever be actually referenced (i.e. called) would be from within the translation unit. Is there a call to it from somewhere else in the translation unit? I don't see any but I'm not sure what the macros expand to.
Anyway I doubt this warning has anything to do with a runtime segfault.
sptel15-199> icpc -c -w1 t.cpp
t.cpp(10): warning #177: function "<unnamed>::NOrec_Generic<CM>::commit [with CM=stm::HourglassBackoffCM]" was declared but never referenced
static void commit(TxThread*);
^
sptel15-200>
class TxThread;
namespace {
template <class CM>
struct NOrec_Generic
{
static void commit(TxThread*);
};
template <class CM>
void
NOrec_Generic<CM>::commit(TxThread* tx)
{ }
}
namespace stm {
struct HourglassBackoffCM {};
NOrec_Generic< HourglassBackoffCM> n;
void foo() {
//n.commit(0); // error disappears if function is referenced (i.e. called)
}
}
If you still think the warning doesn't make sense please preprocess the file (using the -P option) and post the preprocessed file (it will have a i extension) here.
thanks!
Judy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No, it's never called in the translation unit. i can see why the other functions don't give this warning, since they are assigned in the initialize routine. It will be called if set to the stms[].commit function pointer later in the run. I'm compiling with -Wall so it makes sense that it appears. Still, it does not appear with GCC, but then i guess it's a bug on GCC.
And true, it's not connected to my segmentation fault, I have to dig deeper into that one, I just assumed it was since the output was different from GCC, where it doesn't segfault.
Thank you

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page