alibaba / alibaba/yalantinglibs

build warning on Mac

Open
#1,104 3 comments 0 reactions 0 assignees View on GitHub
dependencies
Dominant language
C++
Stars
2.2k
Forks
327
Avg merge
1d 20h
Merged PRs (30d)
2

Description

'sprintf' has been explicitly marked deprecated on Mac when build

```
In file included from yalantinglibs/src/util/tests/main.cpp:18:
yalantinglibs/src/include/doctest.h:3735:1: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
3735 | DOCTEST_TO_STRING_OVERLOAD(int long long unsigned, "%llu")
| ^
yalantinglibs/src/include/doctest.h:3721:14: note: expanded from macro 'DOCTEST_TO_STRING_OVERLOAD'
3721 | std::sprintf(buf, fmt, in); \
| ^
/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/usr/include/_stdio.h:274:1: note: 'sprintf' has been explicitly marked deprecated here
274 | __deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
| ^
/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/usr/include/sys/cdefs.h:218:48: note: expanded from macro '__deprecated_msg'
218 | #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the Mac build for yalantinglibs/src/util/tests/main.cpp and inspect yalantinglibs/src/include/doctest.h around lines 3721-3735, where the warning points to sprintf. Done means the test build no longer emits this Mac deprecation warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.