summaryrefslogtreecommitdiffstats
path: root/scripts/qapi-types.py
diff options
context:
space:
mode:
authorDaniel P. Berrange2015-05-13 18:14:07 +0200
committerAndreas Färber2015-06-19 18:42:18 +0200
commit2e4450ff432daef524cb3557fca68a3b7b5c7823 (patch)
treec900fd8fbef7456b29aaefdc20e91063abcbb3a0 /scripts/qapi-types.py
parentqom: Add object_new_with_props() / object_new_withpropv() helpers (diff)
downloadqemu-2e4450ff432daef524cb3557fca68a3b7b5c7823.tar.gz
qemu-2e4450ff432daef524cb3557fca68a3b7b5c7823.tar.xz
qemu-2e4450ff432daef524cb3557fca68a3b7b5c7823.zip
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>
Diffstat (limited to 'scripts/qapi-types.py')
-rw-r--r--scripts/qapi-types.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py
index d28a6b07be..e6eb4b613a 100644
--- a/scripts/qapi-types.py
+++ b/scripts/qapi-types.py
@@ -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)