Skip to content

Verbose trace strings not disabled with CURL_DISABLE_VERBOSE_STRINGS #20341

@dfandrich

Description

@dfandrich

I did this

A libcurl compiled with --disable-verbose still includes trace logging strings in its binary that are never used, bloating the binary size.

I expected the following

Trace strings should not be included in the binary. This happens because in --disable-verbose mode the macros (e.g. CURL_TRC_CF are not nulled-out but rather the functions (e.g. Curl_trc_cf_infof) that those macros call are set to empty bodies. The compiler then keeps the strings in order to pass them to the empty functions that immediately return.

It appears to me that the intent was to compile away most of the trace subsystem in the CURL_DISABLE_VERBOSE_STRINGS case, so the right fix would seem to replace those macros instead of keeping empty functions around. The trace functions aren't part of the external API and are always called through those macros so this appears safe. If there are side effects in those macros calls this will break, but I hope that nobody is using the trace macros that way.

curl/libcurl version

8.19.0-DEV

operating system

Linux

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions