Skip to content

Commit aa3a102

Browse files
committed
Improve code
1 parent 34e1592 commit aa3a102

File tree

2 files changed

+19
-22
lines changed

2 files changed

+19
-22
lines changed

sanitizers/sanitizers.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,21 @@
2121

2222
std::atomic<char*> globalSanitizerLogPath{nullptr};
2323

24-
void initSanitizerPath(const char* path) {
25-
if (auto* const newPath = strdup(path)) {
26-
if (auto* const oldPath = globalSanitizerLogPath.exchange(newPath)) {
27-
free(oldPath);
24+
extern "C" {
25+
void initSanitizerPath(const char* path) {
26+
if (auto* const newPath = strdup(path)) {
27+
if (auto* const oldPath = globalSanitizerLogPath.exchange(newPath)) {
28+
free(oldPath);
29+
}
2830
}
2931
}
30-
}
3132

32-
extern "C" {
33-
__attribute__((used, visibility("default")))
3433
// NOLINTNEXTLINE(bugprone-reserved-identifier)
3534
const char* __asan_default_options() { return "detect_leaks=1"; }
3635

37-
__attribute__((used, visibility("default")))
3836
// NOLINTNEXTLINE(bugprone-reserved-identifier)
3937
const char* __ubsan_default_options() { return "print_stacktrace=1"; }
4038

41-
__attribute__((used, visibility("default")))
4239
// NOLINTNEXTLINE(bugprone-reserved-identifier)
4340
void __sanitizer_on_print(const char* str) {
4441
static FILE* file = nullptr;

sanitizers/sanitizers.pri

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
/* Copyright 2026 CyberTech Labs Ltd.
2-
*
3-
* Licensed under the Apache License, Version 2.0 (the "License");
4-
* you may not use this file except in compliance with the License.
5-
* You may obtain a copy of the License at
6-
*
7-
* http://www.apache.org/licenses/LICENSE-2.0
8-
*
9-
* Unless required by applicable law or agreed to in writing, software
10-
* distributed under the License is distributed on an "AS IS" BASIS,
11-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
* See the License for the specific language governing permissions and
13-
* limitations under the License. */
1+
# Copyright 2026 CyberTech Labs Ltd.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License. */
1414

1515
SOURCES += $$PWD/sanitizers.cpp
1616
HEADERS += $$PWD/sanitizers.h

0 commit comments

Comments
 (0)