diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2024-03-07 21:04:14 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-07 21:04:14 (GMT) |
commit | 577a32fe83a800b170d4fd8e079fbe2774c9396c (patch) | |
tree | 2a75d2ac8b3de2e389ee5cfee86605ab0720b9a4 /bin | |
parent | bc0c42695f7669f64c00c357880b0dfecf30e343 (diff) | |
download | hdf5-577a32fe83a800b170d4fd8e079fbe2774c9396c.zip hdf5-577a32fe83a800b170d4fd8e079fbe2774c9396c.tar.gz hdf5-577a32fe83a800b170d4fd8e079fbe2774c9396c.tar.bz2 |
Fix bin/trace script w/ out params (#4074)
The bin/trace script adds TRACE macros to public API calls in the main
C library. This script had a parsing bug that caused functions that
were annotated with /*out*/, etc. to be labeled as void pointers
instead of typed pointers.
This is mainly a developer feature and not visible to consumers
of the public API.
The bin/trace script now annotates public API calls properly.
Fixes GH #3733
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/trace | 23 |
1 files changed, 16 insertions, 7 deletions
@@ -31,6 +31,7 @@ $Source = ""; "H5A_operator1_t" => "Ao", "H5A_operator2_t" => "AO", "hbool_t" => "b", + "bool" => "b", "H5AC_cache_config_t" => "Cc", "H5AC_cache_image_config_t" => "CC", "double" => "d", @@ -74,6 +75,7 @@ $Source = ""; "H5F_file_space_type_t" => "Ft", "H5F_libver_t" => "Fv", "H5G_iterate_t" => "Gi", + "H5G_info_t" => "GI", "H5G_obj_t" => "Go", "H5G_stat_t" => "Gs", "hsize_t" => "h", @@ -199,7 +201,7 @@ $Source = ""; "H5FD_t" => "#", "H5FD_hdfs_fapl_t" => "#", "H5FD_mirror_fapl_t" => "#", - "H5FD_onion_fapl_t" => "#", + "H5FD_onion_fapl_t" => "#", "H5FD_ros3_fapl_t" => "#", "H5FD_splitter_vfd_config_t" => "#", "H5L_class_t" => "#", @@ -305,10 +307,18 @@ sub rewrite_func ($$$$$) { $trace = "H5TRACE0(\"$rettype\", \"\");\n"; $argtrace = "H5ARG_TRACE0(\"\")"; } else { - # Split arguments. First convert `/*in,out*/' to get rid of the - # comma and remove lines beginning with a '#', then split the arguments - # on commas. - $args =~ s/(\/\*\s*in),\s*(out\s*\*\/)/$1_$2/g; # Get rid of comma in 'in,out' + # Split arguments + # + # First remove: + # * /*in*/, /*out*/, /*in_out*/, and /*in,out*/ comments + # * preprocessor lines that start with # + # * H5FL_TRACKING_PARAMS macros (free list code only) + # + # then split the function arguments on commas + $args =~ s/\/\*\s*in\s*\*\///g; # Get rid of /*in*/ + $args =~ s/\/\*\s*out\s*\*\///g; # Get rid of /*out*/ + $args =~ s/\/\*\s*in,\s*out\s*\*\///g; # Get rid of /*in,out*/ + $args =~ s/\/\*\s*in_out\s*\*\///g; # Get rid of /*in_out*/ $args =~ s/H5FL_TRACK_PARAMS//g; # Remove free list macro $args =~ s/\n#.*?\n/\n/g; # Remove lines beginning with '#' my @args = split /,[\s\n]*/, $args; @@ -320,8 +330,7 @@ sub rewrite_func ($$$$$) { next; } unless ($arg=~/^((\s*[a-z_A-Z](\w|\*)*\s+)+(\s*\*\s*|\s*const\s*|\s*volatile\s*)*) - ([a-z_A-Z]\w*)(\[.*?\])? - (\s*\/\*\s*(in|out|in_out)\s*\*\/)?\s*$/x) { + ([a-z_A-Z]\w*)(\[.*?\])?\s*$/x) { errmesg $file, $name, "unable to parse \`$arg\'"; goto error; } else { |