Skip to content

Commit

Permalink
compcert: use of undeclared identifier __FUNCTION__
Browse files Browse the repository at this point in the history
a compiler extension.
Only half-way through: compcert throws
Fatal error: uncaught exception Stack overflow
Raised by primitive operation at Debugvar.join.join2 in file "extraction/Debugvar.ml", line 196, characters 36-57
even with all __FUNCTION__ removed.

But still good to catch C11 extensions, like anonymous structs/unions
(which are also problematic for tcc dwarf support).
  • Loading branch information
rurban committed Oct 30, 2023
1 parent 5e4a8c8 commit 631a9b9
Show file tree
Hide file tree
Showing 9 changed files with 349 additions and 308 deletions.
114 changes: 57 additions & 57 deletions src/bits.c

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/dec_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -616,10 +616,10 @@
if ((dat->byte * 8) + 8 + dat->bit > dat->size * 8) \
{ \
loglevel = dat->opts & DWG_OPTS_LOGLEVEL; \
LOG_ERROR ("%s FIELD_DD buffer overflow at pos %" PRIuSIZE \
LOG_ERROR ("FIELD_DD buffer overflow at pos %" PRIuSIZE \
".%u, size %" PRIuSIZE "," \
" advance by 8", \
__FUNCTION__, dat->byte, dat->bit, dat->size); \
dat->byte, dat->bit, dat->size); \
} \
byte = dat->chain[dat->byte]; \
if (dat->bit < 7) \
Expand Down
2 changes: 1 addition & 1 deletion src/decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -4886,7 +4886,7 @@ bit_read_BB_noadv (Bit_Chain *dat)
if (dat->byte >= dat->size)
{
LOG_ERROR ("%s buffer overflow at %" PRIuSIZE " >= %" PRIuSIZE,
__FUNCTION__, dat->byte, dat->size)
"bit_read_BB_noadv", dat->byte, dat->size)
return 9;
}
byte = dat->chain[dat->byte];
Expand Down
11 changes: 6 additions & 5 deletions src/decode_r2007.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ decompress_r2007 (BITCODE_RC *restrict dst, const unsigned dst_size,
src_size);
if (!dst || !src || !dst_size || src_size < 2)
{
LOG_ERROR ("Invalid argument to %s\n", __FUNCTION__);
LOG_ERROR ("Invalid argument to %s\n", "decompress_r2007");
return DWG_ERR_INTERNALERROR;
}

Expand Down Expand Up @@ -1233,7 +1233,7 @@ read_file_header (Bit_Chain *restrict dat,
{ \
errcount++; \
error |= DWG_ERR_VALUEOUTOFBOUNDS; \
LOG_ERROR ("%s Invalid %s %ld > MAX_SIZE", __FUNCTION__, #var, \
LOG_ERROR ("%s Invalid %s %ld > MAX_SIZE", "read_file_header", #var, \
(long)var) \
var = 0; \
}
Expand All @@ -1242,7 +1242,7 @@ read_file_header (Bit_Chain *restrict dat,
{ \
errcount++; \
error |= DWG_ERR_VALUEOUTOFBOUNDS; \
LOG_ERROR ("%s Invalid %s %ld > MAX_COUNT", __FUNCTION__, #var, \
LOG_ERROR ("%s Invalid %s %ld > MAX_COUNT", "read_file_header", #var, \
(long)var) \
var = 0; \
}
Expand Down Expand Up @@ -2364,7 +2364,8 @@ read_r2007_meta_data (Bit_Chain *dat, Bit_Chain *hdl_dat,
{
LOG_ERROR ("%s Invalid pages_map_size_comp %" PRIuSIZE " > %" PRIuSIZE
" bytes left",
__FUNCTION__, (size_t)file_header->pages_map_size_comp,
"read_r2007_meta_data",
(size_t)file_header->pages_map_size_comp,
dat->size - dat->byte)
error |= DWG_ERR_VALUEOUTOFBOUNDS;
goto error;
Expand All @@ -2389,7 +2390,7 @@ read_r2007_meta_data (Bit_Chain *dat, Bit_Chain *hdl_dat,
{
LOG_ERROR ("%s Invalid comp_data_size %" PRId64 " > %" PRIuSIZE
" bytes left",
__FUNCTION__, file_header->sections_map_size_comp,
"read_r2007_meta_data", file_header->sections_map_size_comp,
dat->size - dat->byte)
error |= DWG_ERR_VALUEOUTOFBOUNDS;
goto error;
Expand Down
Loading

0 comments on commit 631a9b9

Please sign in to comment.