mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
qom: Make enum string tables const-correct
The enum string table parameters in various QOM/QAPI methods are declared 'const char *strings[]'. This results in const warnings if passed a variable that was declared as static const char * const strings[] = { .... }; Add the extra const annotation to the parameters, since neither the string elements, nor the array itself should ever be modified. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
a31bdae5a7
commit
2e4450ff43
10 changed files with 16 additions and 15 deletions
|
@ -105,7 +105,7 @@ struct %(name)s
|
|||
|
||||
def generate_enum_lookup(name, values):
|
||||
ret = mcgen('''
|
||||
const char *%(name)s_lookup[] = {
|
||||
const char * const %(name)s_lookup[] = {
|
||||
''',
|
||||
name=c_name(name))
|
||||
i = 0
|
||||
|
@ -128,7 +128,7 @@ const char *%(name)s_lookup[] = {
|
|||
def generate_enum(name, values):
|
||||
name = c_name(name)
|
||||
lookup_decl = mcgen('''
|
||||
extern const char *%(name)s_lookup[];
|
||||
extern const char * const %(name)s_lookup[];
|
||||
''',
|
||||
name=name)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue