Hello Everyone
I'm trying to track a few tricky problems with stralign.h
I was looking at this previously but had to drop it but I'm now looking at
it again.
Consider this program (distilled from stralign.h):
#define TRUE 1
#define WSTR_ALIGNED(s) TRUE
inline int strwhatever(const char* String1,const char* String2)
{
if(WSTR_ALIGNED(String1) && WSTR_ALIGNED(String2))
return 1;
return 0;
}
int main()
{
strwhatever(0,0);
}
Compiling this code with clang++, gets these errors:
sa.cpp:6:30: warning: use of logical '&&' with constant operand
[-Wconstant-logical-operand]
if(WSTR_ALIGNED(String1) && WSTR_ALIGNED(String2))
^ ~~~~~~~~~~~~~~~~~~~~~
sa.cpp:6:30: note: use '&' for a bitwise operation
if(WSTR_ALIGNED(String1) && WSTR_ALIGNED(String2))
^~
&
sa.cpp:6:30: note: remove constant to silence this warning
if(WSTR_ALIGNED(String1) && WSTR_ALIGNED(String2))
~^~~~~~~~~~~~~~~~~~~~~~~~
If you compile stralign.h with clang at -O3, you'll get similar errors.
I'd like to propose someone with access change such code so that doesn't
raise these errors.
Doing so would would require changing code like that above and in
stralign.h so that it did something more like this:
#define WSTR_ALIGNED(s) true
The other thing to note as that these errors don't always appear or appear
with clang at -O3
because these functions aren't always processed / inlined, so don't warn on
it because of
__CRT__NO_INLINE / __NO_INLINE__ see _mingw.h but this is a topic for
another email.
On my machine by default g++ doesn't warn on this.
Would somebody mind changing this please?
I'm compiling code from rev 5 here:
http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/4.8.1/64-bit/threads-win32/seh/
If there is more recent code that I should look to that doesn't exhibit
this problem it'd be great if someone could provide me a link to it and any
info on how to update my rev 5 tree with it, if that's how it's supposed to
work.
Thanks
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public