mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-05-14 07:19:36 +08:00
userspace-header-gen: Don't generate first array size.
This commit is contained in:
parent
120caa668f
commit
46d0378cc6
@ -111,7 +111,7 @@ class HeaderGenCU:
|
|||||||
def _die_is_function(self, die):
|
def _die_is_function(self, die):
|
||||||
return (die.tag == "DW_TAG_subprogram")
|
return (die.tag == "DW_TAG_subprogram")
|
||||||
|
|
||||||
def _get_type(self, die):
|
def _get_type(self, die, first_array = True):
|
||||||
"""Get the type of a variable DIE.
|
"""Get the type of a variable DIE.
|
||||||
Returns two strings: one prefix and one postfix for the variable name"""
|
Returns two strings: one prefix and one postfix for the variable name"""
|
||||||
typepre = ""
|
typepre = ""
|
||||||
@ -139,11 +139,15 @@ class HeaderGenCU:
|
|||||||
elif (typedie.tag == "DW_TAG_array_type"):
|
elif (typedie.tag == "DW_TAG_array_type"):
|
||||||
for child in typedie.iter_children():
|
for child in typedie.iter_children():
|
||||||
if child.tag == "DW_TAG_subrange_type":
|
if child.tag == "DW_TAG_subrange_type":
|
||||||
try:
|
if first_array == True:
|
||||||
upper_bound = child.attributes["DW_AT_upper_bound"].value
|
|
||||||
arraysize = "%d" % (upper_bound + 1)
|
|
||||||
except KeyError:
|
|
||||||
arraysize = ""
|
arraysize = ""
|
||||||
|
first_array = False
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
upper_bound = child.attributes["DW_AT_upper_bound"].value
|
||||||
|
arraysize = "%d" % (upper_bound + 1)
|
||||||
|
except KeyError:
|
||||||
|
arraysize = ""
|
||||||
typepost += "[%s]" % arraysize
|
typepost += "[%s]" % arraysize
|
||||||
|
|
||||||
elif (typedie.tag == "DW_TAG_volatile_type"):
|
elif (typedie.tag == "DW_TAG_volatile_type"):
|
||||||
@ -200,7 +204,7 @@ class HeaderGenCU:
|
|||||||
raise TypenameNotFoundError(message)
|
raise TypenameNotFoundError(message)
|
||||||
|
|
||||||
if last == False:
|
if last == False:
|
||||||
addpre, addpost = self._get_type(typedie)
|
addpre, addpost = self._get_type(typedie, first_array)
|
||||||
typepre = addpre + typepre
|
typepre = addpre + typepre
|
||||||
typepost = typepost + addpost
|
typepost = typepost + addpost
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user