[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
classpath, csharpexec: Avoid "candidate for attribute 'malloc'" warning
From: |
Bruno Haible |
Subject: |
classpath, csharpexec: Avoid "candidate for attribute 'malloc'" warning |
Date: |
Sat, 03 Jun 2023 13:16:09 +0200 |
In GNU gettext, I see these warnings when compiling with gcc 13, warnings,
and -O2:
gettext-tools/gnulib-lib/classpath.c:97:1: warning: function might be candidate
for attribute 'malloc' [-Wsuggest-attribute=malloc]
gettext-tools/gnulib-lib/csharpexec.c:36:23: warning: function might be
candidate for attribute 'malloc' [-Wsuggest-attribute=malloc]
gettext-tools/gnulib-lib/csharpexec.c:57:23: warning: function might be
candidate for attribute 'malloc' [-Wsuggest-attribute=malloc]
This patch follows the advice.
2023-06-03 Bruno Haible <bruno@clisp.org>
classpath, csharpexec: Avoid "candidate for attribute 'malloc'" warning.
* lib/classpath.h (set_classpath): Mark with attribute 'malloc'.
diff --git a/lib/classpath.h b/lib/classpath.h
index abcb4cbe40..65123140cf 100644
--- a/lib/classpath.h
+++ b/lib/classpath.h
@@ -15,6 +15,11 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
+/* This file uses _GL_ATTRIBUTE_MALLOC. */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
/* Return the new CLASSPATH value. The given classpaths are prepended to
the current CLASSPATH value. If use_minimal_classpath, the current
CLASSPATH is ignored. */
@@ -25,7 +30,8 @@ extern char * new_classpath (const char * const *classpaths,
/* Set CLASSPATH and returns a safe copy of its old value. */
extern char * set_classpath (const char * const *classpaths,
unsigned int classpaths_count,
- bool use_minimal_classpath, bool verbose);
+ bool use_minimal_classpath, bool verbose)
+ _GL_ATTRIBUTE_MALLOC;
/* Restore CLASSPATH to its previous value. */
extern void reset_classpath (char *old_classpath);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- classpath, csharpexec: Avoid "candidate for attribute 'malloc'" warning,
Bruno Haible <=