emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scratch/igc 3f15b8b1f8c 1/3: Warn about unused return values from MPS fu


From: Gerd Moellmann
Subject: scratch/igc 3f15b8b1f8c 1/3: Warn about unused return values from MPS functions (clang only)
Date: Tue, 9 Jul 2024 05:25:09 -0400 (EDT)

branch: scratch/igc
commit 3f15b8b1f8cf0e131e357b93e0f4035da7109dae
Author: Gerd Möllmann <gerd@gnu.org>
Commit: Gerd Möllmann <gerd@gnu.org>

    Warn about unused return values from MPS functions (clang only)
---
 src/igc.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/igc.c b/src/igc.c
index 330be3fe088..bdb25c8a61a 100644
--- a/src/igc.c
+++ b/src/igc.c
@@ -21,12 +21,24 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>. */
 #include <config.h>
 #include <limits.h>
 #include <signal.h>
+#ifdef __clang__
+/* You want to use this without -Wignored-attributes because it worns
+   that it cannot add the attribute to functions returning void.*/
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wignored-attributes"
+# pragma clang attribute push(__attribute__((warn_unused_result)), \
+                             apply_to = hasType(functionType))
+#endif
 #include <mps.h>
 #include <mpsavm.h>
 #include <mpscamc.h>
 #include "mpscams.h"
 #include <mpscawl.h>
 #include <mpslib.h>
+#ifdef __clang__
+#pragma clang attribute pop
+#pragma clang diagnostic pop
+#endif
 #include <stdlib.h>
 #include "lisp.h"
 #include "comp.h"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]