Whilst trying to compile the QEMU VGA driver I came across an error when trying to initialise a structure with a Pascal string constant which can be demonstrated as below:
When compiled with powerpc-apple-macos-gcc test.c the following error is emitted:
test.c:10:9: error: cannot initialize array of 'unsigned char' from a string literal with type array of 'unsigned char'
10 | "\p.Display_Video_QemuVGA",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
test.c:10:9: note: (near initialization for 'TheDriverDescription.driverType.nameInfoStr')
test.c:22:9: error: cannot initialize array of 'unsigned char' from a string literal with type array of 'unsigned char'
22 | "\p.Display_Video_QemuVGA", /* Str31 driverName (OpenDriver param) */
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
test.c:22:9: note: (near initialization for 'TheDriverDescription.driverOSRuntimeInfo.driverName')
If I change the constants from e.g. "\p.Display_Video_QemuVGA" to "\n.Display_Video_QemuVGA" then compilation succeeds so it seems to be related to the implementation of Pascal string constants.
Whilst trying to compile the QEMU VGA driver I came across an error when trying to initialise a structure with a Pascal string constant which can be demonstrated as below:
When compiled with
powerpc-apple-macos-gcc test.c
the following error is emitted:If I change the constants from e.g.
"\p.Display_Video_QemuVGA"
to"\n.Display_Video_QemuVGA"
then compilation succeeds so it seems to be related to the implementation of Pascal string constants.