Skip to content

C++: In std=gnu++2b size-optimized builds std::string methods are inlined #67

@rojer

Description

@rojer

Checklist

  • Checked the issue tracker for similar issues to ensure this is not a duplicate
  • Read the documentation to confirm the issue is not addressed there and your configuration is set correctly
  • Tested with the latest version to ensure the issue hasn't been fixed

How often does this bug occurs?

always

Expected behavior

I expected frequently used functions such as std::string::append not to be inlined, at least not in -Os mode.

Actual behavior (suspected bug)

Instead, when switching from gnu++17 to gnu++2b standard std::string functions such as append, resize, instead appear to be inlined. This alone is responsible for significant binary size increase for our application.

Error logs or terminal output

No response

Steps to reproduce the behavior

test file: https://gist.github.com/rojer/81900a923fdfa7e6853afe72fa2ea87b

to change the standard: edit tools/cmake/build.cmake, change the cxx_std variable.

it's obvious that in c++17 mode std::string methods are invoked while in c++2b mode they are inlined.

Project release version

14.2.0_20240906

System architecture

other (details in Additional context)

Operating system

Linux

Operating system version

Ubuntu 24.04

Shell

Bash

Additional context

IDF 5.2.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions