@@ -211,6 +211,7 @@ def __init__(self):
211
211
_define_directive_re = re .compile (r'\s*#\s*define\s+(\w+)' +
212
212
r'(?:\s+|\((\w+)\)\s*)' +
213
213
r'(.+)' )
214
+ _deprecated_definition_re = re .compile ('\s*MBEDTLS_DEPRECATED' )
214
215
215
216
def read_line (self , line ):
216
217
"""Parse a C header line and record the PSA identifier it defines if any.
@@ -223,20 +224,16 @@ def read_line(self, line):
223
224
return
224
225
name , parameter , expansion = m .groups ()
225
226
expansion = re .sub (r'/\*.*?\*/|//.*' , r' ' , expansion )
227
+ if re .match (self ._deprecated_definition_re , expansion ):
228
+ # Skip deprecated values, which are assumed to be
229
+ # backward compatibility aliases that share
230
+ # numerical values with non-deprecated values.
231
+ return
226
232
if name .endswith ('_FLAG' ) or name .endswith ('MASK' ):
227
233
# Macro only to build actual values
228
234
return
229
235
elif (name .startswith ('PSA_ERROR_' ) or name == 'PSA_SUCCESS' ) \
230
236
and not parameter :
231
- if name in ['PSA_ERROR_UNKNOWN_ERROR' ,
232
- 'PSA_ERROR_OCCUPIED_SLOT' ,
233
- 'PSA_ERROR_EMPTY_SLOT' ,
234
- 'PSA_ERROR_INSUFFICIENT_CAPACITY' ,
235
- ]:
236
- # Ad hoc skipping of deprecated error codes, which share
237
- # numerical values with non-deprecated error codes
238
- return
239
-
240
237
self .statuses .add (name )
241
238
elif name .startswith ('PSA_KEY_TYPE_' ) and not parameter :
242
239
self .key_types .add (name )
0 commit comments