Laszlo Ersek [mailto:[email protected]] wrote:

<snip>

]You wanted to write "&" rather than "&&", but this mistake only makes
]your point more clear. :)

Oh, you are certainly right. I did mess that up. Here is a revised test.
I also added one more test case, along with gcc -Wconversion results. The
gcc -Wconversion addition is because Liming asked about it. I will put
details about gcc -Wconversion in the response to his email.


#if defined (__GNUC__)
#include <stdint.h>
#else
#define uint8_t  unsigned __int8
#define uint16_t unsigned __int16
#define uint32_t unsigned __int32
#define uint64_t unsigned __int64
#endif
uint8_t test1 (int x) {return !x;}
uint8_t test2 (int x) {return x == 1;}
uint8_t test3 (int x) {return x && 1;}
uint32_t test4 (uint64_t x) {return x >> 32;}
uint32_t test5 (uint64_t x) {return x & 0xFFFFFFFF;}
enum {a=1, b=2}; uint16_t test6 (int x) {return x ? a : b;}
uint8_t  test7 (uint8_t a, uint8_t b) {return a + b;}

/*
                            W A R N I N G   C O U N T S
Tool chain         test1  test2  test3  test4  test5  test6  test7
DDK3790 /W4          1      1      1      1      1      1      0
VS2003  /W4          1      1      1      1      1      1      0
VS2005  /W4          1      1      1      1      1      0      0
VS2008  /W4          0      0      0      0      0      0      0
VS2010  /W4          0      0      0      0      0      0      0
VS2012  /W4          0      0      0      0      0      0      0
VS2013  /W4          0      0      0      0      0      0      0
gcc430 -Wconversion  1      1      1      1      1      1      1
gcc490 -Wconversion  0      0      0      1      0      0      1


<snip>

]I'd appreciate if such a patch was applied.
]
]Thanks
]Laszlo

OK, your vote is to remove Microsoft C4244 from VS2005 and older.
See my response to Liming's comments for more discussion.

Thanks,
Scott

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel


------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to