Skip to content
  • Markus Armbruster's avatar
    638c4af9
    qapi: Clean up member name case checking · 638c4af9
    Markus Armbruster authored
    
    
    QAPISchemaMember.check_clash() checks for member names that map to the
    same c_name().  Takes care of rejecting duplicate names.
    
    It also checks a naming rule: no uppercase in member names.  That's a
    rather odd place to do it.  Enforcing naming rules is
    check_name_str()'s job.
    
    qapi-code-gen.txt specifies the name case rule applies to the name as
    it appears in the schema.  check_clash() checks c_name(name) instead.
    No difference, as c_name() leaves alone case, but unclean.
    
    Move the name case check into check_name_str(), less the c_name().
    New argument @permit_upper suppresses it.  Pass permit_upper=True for
    definitions (which are not members), and when the member's owner is
    whitelisted with pragma name-case-whitelist.
    
    Bonus: name-case-whitelist now applies to a union's inline base, too.
    Update qapi/qapi-schema.json pragma to whitelist union CpuInfo instead
    of CpuInfo's implicit base type's name q_obj_CpuInfo-base.
    
    Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Message-Id: <20190927134639.4284-6-armbru@redhat.com>
    638c4af9
    qapi: Clean up member name case checking
    Markus Armbruster authored
    
    
    QAPISchemaMember.check_clash() checks for member names that map to the
    same c_name().  Takes care of rejecting duplicate names.
    
    It also checks a naming rule: no uppercase in member names.  That's a
    rather odd place to do it.  Enforcing naming rules is
    check_name_str()'s job.
    
    qapi-code-gen.txt specifies the name case rule applies to the name as
    it appears in the schema.  check_clash() checks c_name(name) instead.
    No difference, as c_name() leaves alone case, but unclean.
    
    Move the name case check into check_name_str(), less the c_name().
    New argument @permit_upper suppresses it.  Pass permit_upper=True for
    definitions (which are not members), and when the member's owner is
    whitelisted with pragma name-case-whitelist.
    
    Bonus: name-case-whitelist now applies to a union's inline base, too.
    Update qapi/qapi-schema.json pragma to whitelist union CpuInfo instead
    of CpuInfo's implicit base type's name q_obj_CpuInfo-base.
    
    Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Message-Id: <20190927134639.4284-6-armbru@redhat.com>
Loading