Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Trac Trac
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Service Desk
    • Milestones
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • Legacy
  • TracTrac
  • Issues
  • #30179
Closed (moved) (moved)
Open
Issue created Apr 14, 2019 by Trac@tracbot

Building with 'ALL_BUGS_ARE_FATAL' fails because of formatted assertion changes.

Building with ALL_BUGS_ARE_FATAL should AFAICS normally be reserved for Coverty and/or analysers. But just for kicks, I've added -DALL_BUGS_ARE_FATAL to my CFLAGS.

This causes errors like these (from clang using a git-checkout from today):

buf/buffers.c(531,7):  error: too few arguments to function call, expected at least 5, have 4
  if (BUG(buf->datalen >= INT_MAX))
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
..\lib/log/util_bug.h(151,70):  note: expanded from macro 'BUG'
   (tor_assertion_failed_(SHORT_FILE__,__LINE__,__func__,"!("#cond")"), \
    ~~~~~~~~~~~~~~~~~~~~~                                            ^
..\lib/log/util_bug.h(242,1):  note: 'tor_assertion_failed_' declared here
void tor_assertion_failed_(const char *fname, unsigned int line,
^
buf/buffers.c(533,7):  error: too few arguments to function call, expected at least 5, have 4
  if (BUG(buf->datalen >= INT_MAX - string_len))
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...

I've used this patch to fix it:

--- a/src/lib/log/util_bug.h 2019-04-14 03:56:41
+++ b/src/lib/log/util_bug.h 2019-04-14 11:31:23
@@ -148,7 +148,7 @@
 #define tor_assert_nonfatal_once(cond) tor_assert((cond))
 #define BUG(cond)                                                       \
   (ASSERT_PREDICT_UNLIKELY_(cond) ?                                     \
-   (tor_assertion_failed_(SHORT_FILE__,__LINE__,__func__,"!("#cond")"), \
+   (tor_assertion_failed_(SHORT_FILE__,__LINE__,__func__,"!("#cond")", NULL), \
     abort(), 1)                                                         \
    : 0)
 #elif defined(TOR_UNIT_TESTS) && defined(DISABLE_ASSERTS_IN_UNIT_TESTS)

W/o knowing what the correct fix would be.

Trac:
Username: gvanem

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking