Revision eda50a65 scripts/qapi.py

b/scripts/qapi.py
141 141
            new_name += ch.lower()
142 142
    return new_name
143 143

  
144
def c_var(name):
144
def c_var(name, protect=True):
145 145
    # ANSI X3J11/88-090, 3.1.1
146 146
    c89_words = set(['auto', 'break', 'case', 'char', 'const', 'continue',
147 147
                     'default', 'do', 'double', 'else', 'enum', 'extern', 'float',
......
156 156
    # GCC http://gcc.gnu.org/onlinedocs/gcc-4.7.1/gcc/C-Extensions.html
157 157
    # excluding _.*
158 158
    gcc_words = set(['asm', 'typeof'])
159
    if name in c89_words | c99_words | c11_words | gcc_words:
159
    if protect and (name in c89_words | c99_words | c11_words | gcc_words):
160 160
        return "q_" + name
161 161
    return name.replace('-', '_').lstrip("*")
162 162

  
163
def c_fun(name):
164
    return c_var(name).replace('.', '_')
163
def c_fun(name, protect=True):
164
    return c_var(name, protect).replace('.', '_')
165 165

  
166 166
def c_list_type(name):
167 167
    return '%sList' % name

Also available in: Unified diff