blob: 05371e5cd6729aa397884d5cae578eddb1e1f654 [file] [log] [blame]
Patrick Williams864cc432023-02-09 14:54:44 -06001From abaac31d1cb4d0ba0e8e9ef7f344e62de3b150de Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 4 Feb 2023 16:50:46 -0800
4Subject: [PATCH] minicoredumper_demo: Use 'optnone' attribute with clang
5
6clang does not support optimize("On") yet, therefore use optnone which
7should give intended results with clang compiler
8
9Upstream-Status: Submitted [https://github.com/diamon/minicoredumper/pull/7]
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 src/minicoredumper_demo/main.c | 9 +++++++--
13 1 file changed, 7 insertions(+), 2 deletions(-)
14
15diff --git a/src/minicoredumper_demo/main.c b/src/minicoredumper_demo/main.c
16index 65aac46..e60eb82 100644
17--- a/src/minicoredumper_demo/main.c
18+++ b/src/minicoredumper_demo/main.c
19@@ -11,8 +11,13 @@
20 #include <sys/types.h>
21
22 #include "minicoredumper.h"
23-
24-int __attribute__((optimize("O0"))) main(int argc, char *argv[])
25+int
26+#ifdef __clang__
27+__attribute__((optnone))
28+#else
29+__attribute__((optimize("O0")))
30+#endif
31+main(int argc, char *argv[])
32 {
33 char *str1 = "This is string 1.";
34 unsigned long val1 = 0x1abc123f;
35--
362.39.1
37