Re: [Mingw-w64-public] [PATCH] genpeimg: fix build error with clang v16

2023-04-03 Thread JonY via Mingw-w64-public

On 4/2/23 15:40, Christoph Reiter wrote:

Building genpeimg with clang v16 fails like:

error: implicit truncation from 'int' to a one-bit wide bit-field changes value 
from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
 pe->is_64bit = 1;

is_64bit is always ever comapred against 0 in our case, so the value change
doesn't matter, but let's just make it unsigned to fix the error and avoid
any future confusion.

The same is theoretically true for is_bigendian, but that currently
never set to 1 in any place. Make it unsigned as well while at it.
---
  mingw-w64-tools/genpeimg/src/img.h | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mingw-w64-tools/genpeimg/src/img.h 
b/mingw-w64-tools/genpeimg/src/img.h
index 6e969a175..dd47a0f4b 100644
--- a/mingw-w64-tools/genpeimg/src/img.h
+++ b/mingw-w64-tools/genpeimg/src/img.h
@@ -67,8 +67,8 @@ typedef struct pe_image {
size_t optional_hdr_pos;
size_t section_list;
size_t section_list_sz; /* Each section entry has 40 bytes size.  */
-  int is_64bit : 1;
-  int is_bigendian : 1;
+  unsigned int is_64bit : 1;
+  unsigned int is_bigendian : 1;
  } pe_image;
  
  pe_image *peimg_create (file_image *pimg);


Thanks, pushed to master branch.



___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] [PATCH] genpeimg: fix build error with clang v16

2023-04-02 Thread Christoph Reiter
Building genpeimg with clang v16 fails like:

error: implicit truncation from 'int' to a one-bit wide bit-field changes value 
from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
pe->is_64bit = 1;

is_64bit is always ever comapred against 0 in our case, so the value change
doesn't matter, but let's just make it unsigned to fix the error and avoid
any future confusion.

The same is theoretically true for is_bigendian, but that currently
never set to 1 in any place. Make it unsigned as well while at it.
---
 mingw-w64-tools/genpeimg/src/img.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mingw-w64-tools/genpeimg/src/img.h 
b/mingw-w64-tools/genpeimg/src/img.h
index 6e969a175..dd47a0f4b 100644
--- a/mingw-w64-tools/genpeimg/src/img.h
+++ b/mingw-w64-tools/genpeimg/src/img.h
@@ -67,8 +67,8 @@ typedef struct pe_image {
   size_t optional_hdr_pos;
   size_t section_list;
   size_t section_list_sz; /* Each section entry has 40 bytes size.  */
-  int is_64bit : 1;
-  int is_bigendian : 1;
+  unsigned int is_64bit : 1;
+  unsigned int is_bigendian : 1;
 } pe_image;
 
 pe_image *peimg_create (file_image *pimg);
-- 
2.40.0



___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public