[PATCH 2/2] utiltest: Don't assume 'char' is always signed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Not every architecture out there has 'char' signed by default.
For instance, my arm box has it unsigned by default:

  $ gcc -dM -E - < /dev/null | grep __CHAR_UNSIGNED__
  #define __CHAR_UNSIGNED__ 1

Therefore, after 65c61e50 the test if failing for me. Problem is,
we are trying to assign couple of negative values into char
assuming some will overflow and some don't. That can't be the
case if 'char' is unsigned by default.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 tests/utiltest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/utiltest.c b/tests/utiltest.c
index 3a1f8eb..9eb7fb6 100644
--- a/tests/utiltest.c
+++ b/tests/utiltest.c
@@ -185,7 +185,7 @@ testOverflowCheckMacro(const void *data ATTRIBUTE_UNUSED)
 {
     long long tmp;
     unsigned char luchar;
-    char lchar;
+    signed char lchar;
 
     TEST_OVERFLOW(luchar, 254, false);
     TEST_OVERFLOW(luchar, 255, false);
-- 
2.3.6

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]