@@ -1769,6 +1769,16 @@ static int stabs_struct_find(TCCState *s1, Sym *t, int *p_id)
17691769 return 1 ;
17701770}
17711771
1772+ static int remove_type_info (int type )
1773+ {
1774+ type &= ~(VT_STORAGE | VT_CONSTANT | VT_VOLATILE | VT_VLA );
1775+ if ((type & VT_BTYPE ) != VT_BYTE )
1776+ type &= ~VT_DEFSIGN ;
1777+ if (!(type & VT_BITFIELD ) && (type & VT_STRUCT_MASK ) > VT_ENUM )
1778+ type &= ~VT_STRUCT_MASK ;
1779+ return type ;
1780+ }
1781+
17721782static void tcc_get_debug_info (TCCState * s1 , Sym * s , CString * result )
17731783{
17741784 int type ;
@@ -1778,11 +1788,7 @@ static void tcc_get_debug_info(TCCState *s1, Sym *s, CString *result)
17781788 CString str ;
17791789
17801790 for (;;) {
1781- type = t -> type .t & ~(VT_STORAGE | VT_CONSTANT | VT_VOLATILE | VT_VLA );
1782- if ((type & VT_BTYPE ) != VT_BYTE )
1783- type &= ~VT_DEFSIGN ;
1784- if (!(type & VT_BITFIELD ) && (type & VT_STRUCT_MASK ) > VT_ENUM )
1785- type &= ~VT_STRUCT_MASK ;
1791+ type = remove_type_info (t -> type .t );
17861792 if (type == VT_PTR || type == (VT_PTR | VT_ARRAY ))
17871793 n ++ , t = t -> type .ref ;
17881794 else
@@ -1861,9 +1867,7 @@ static void tcc_get_debug_info(TCCState *s1, Sym *s, CString *result)
18611867 cstr_printf (result , "%d=" , ++ debug_next_type );
18621868 t = s ;
18631869 for (;;) {
1864- type = t -> type .t & ~(VT_STORAGE | VT_CONSTANT | VT_VOLATILE | VT_VLA );
1865- if ((type & VT_BTYPE ) != VT_BYTE )
1866- type &= ~VT_DEFSIGN ;
1870+ type = remove_type_info (t -> type .t );
18671871 if (type == VT_PTR )
18681872 cstr_printf (result , "%d=*" , ++ debug_next_type );
18691873 else if (type == (VT_PTR | VT_ARRAY ))
@@ -1901,11 +1905,7 @@ static int tcc_get_dwarf_info(TCCState *s1, Sym *s)
19011905 if (new_file )
19021906 put_new_file (s1 );
19031907 for (;;) {
1904- type = t -> type .t & ~(VT_STORAGE | VT_CONSTANT | VT_VOLATILE | VT_VLA );
1905- if ((type & VT_BTYPE ) != VT_BYTE )
1906- type &= ~VT_DEFSIGN ;
1907- if (!(type & VT_BITFIELD ) && (type & VT_STRUCT_MASK ) > VT_ENUM )
1908- type &= ~VT_STRUCT_MASK ;
1908+ type = remove_type_info (t -> type .t );
19091909 if (type == VT_PTR || type == (VT_PTR | VT_ARRAY ))
19101910 t = t -> type .ref ;
19111911 else
@@ -2052,9 +2052,7 @@ static int tcc_get_dwarf_info(TCCState *s1, Sym *s)
20522052 e = NULL ;
20532053 t = s ;
20542054 for (;;) {
2055- type = t -> type .t & ~(VT_STORAGE | VT_CONSTANT | VT_VOLATILE | VT_VLA );
2056- if ((type & VT_BTYPE ) != VT_BYTE )
2057- type &= ~VT_DEFSIGN ;
2055+ type = remove_type_info (t -> type .t );
20582056 if (type == VT_PTR ) {
20592057 i = dwarf_info_section -> data_offset ;
20602058 if (retval == debug_type )
0 commit comments