[SeaBIOS] [PATCH] block: Fix compilation with CentOS 6

Andrew Cooper posted 1 patch 5 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/seabios tags/patchew/1553251457-20940-1-git-send-email-andrew.cooper3@citrix.com
src/hw/blockcmd.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
[SeaBIOS] [PATCH] block: Fix compilation with CentOS 6
Posted by Andrew Cooper 5 years ago
GCC 4.4 from CentOS 6 chokes in the following way:

  src/hw/blockcmd.c: In function 'scsi_rep_luns_scan':
  src/hw/blockcmd.c:229: error: unknown field 'cdbcmd' specified in initializer
  src/hw/blockcmd.c:229: warning: missing braces around initializer
  src/hw/blockcmd.c:229: warning: (near initialization for 'op.<anonymous>')
  src/hw/blockcmd.c:229: warning: initialization makes integer from pointer without a cast

Avoid using an initialiser list.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
Discovered while adding CentOS 6 to Xen's CI system.  If this patch is
acceptable, what are the chances of having it backported to 1.12-stable ?
---
 src/hw/blockcmd.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/hw/blockcmd.c b/src/hw/blockcmd.c
index 1f15081..a40f37c 100644
--- a/src/hw/blockcmd.c
+++ b/src/hw/blockcmd.c
@@ -222,16 +222,17 @@ int scsi_rep_luns_scan(struct drive_s *tmp_drive, scsi_add_lun add_lun)
     struct cdb_report_luns cdb = {
         .command = CDB_CMD_REPORT_LUNS,
     };
-    struct disk_op_s op = {
-        .drive_fl = tmp_drive,
-        .command = CMD_SCSI,
-        .count = 1,
-        .cdbcmd = &cdb,
-    };
+    /* GCC 4.4 (CentOS 6) can't initialise anonymous unions. */
+    struct disk_op_s op = {};
     struct cdbres_report_luns *resp;
 
     ASSERT32FLAT();
 
+    op.drive_fl = tmp_drive;
+    op.command = CMD_SCSI;
+    op.count = 1;
+    op.cdbcmd = &cdb;
+
     while (1) {
         op.blocksize = sizeof(struct cdbres_report_luns) +
             maxluns * sizeof(struct scsi_lun);
-- 
2.1.4
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH] block: Fix compilation with CentOS 6
Posted by Kevin O'Connor 5 years ago
On Fri, Mar 22, 2019 at 10:44:17AM +0000, Andrew Cooper wrote:
> GCC 4.4 from CentOS 6 chokes in the following way:
> 
>   src/hw/blockcmd.c: In function 'scsi_rep_luns_scan':
>   src/hw/blockcmd.c:229: error: unknown field 'cdbcmd' specified in initializer
>   src/hw/blockcmd.c:229: warning: missing braces around initializer
>   src/hw/blockcmd.c:229: warning: (near initialization for 'op.<anonymous>')
>   src/hw/blockcmd.c:229: warning: initialization makes integer from pointer without a cast
> 
> Avoid using an initialiser list.

Thanks, but note that gcc v4.4 was officially deprecated:

https://mail.coreboot.org/pipermail/seabios/2017-November/011932.html

I don't recall if the problem was limited to just the issue you
outlined in your email or if there were additional issues.

-Kevin
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH] block: Fix compilation with CentOS 6
Posted by Andrew Cooper 5 years ago
On 22/03/2019 14:40, Kevin O'Connor wrote:
> On Fri, Mar 22, 2019 at 10:44:17AM +0000, Andrew Cooper wrote:
>> GCC 4.4 from CentOS 6 chokes in the following way:
>>
>>   src/hw/blockcmd.c: In function 'scsi_rep_luns_scan':
>>   src/hw/blockcmd.c:229: error: unknown field 'cdbcmd' specified in initializer
>>   src/hw/blockcmd.c:229: warning: missing braces around initializer
>>   src/hw/blockcmd.c:229: warning: (near initialization for 'op.<anonymous>')
>>   src/hw/blockcmd.c:229: warning: initialization makes integer from pointer without a cast
>>
>> Avoid using an initialiser list.
> Thanks, but note that gcc v4.4 was officially deprecated:
>
> https://mail.coreboot.org/pipermail/seabios/2017-November/011932.html
>
> I don't recall if the problem was limited to just the issue you
> outlined in your email or if there were additional issues.

Oh ok.  I think I'll see about excluding SeaBIOS from this particular CI
build then.

Sorry for the noise.

~Andrew
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org