Rainer --

I took the liberty of adding similar examples to https://svn.open-mpi.org/trac/ompi/wiki/CompilerAttributes .

On Jul 31, 2008, at 11:46 AM, rusra...@osl.iu.edu wrote:

Author: rusraink
Date: 2008-07-31 11:46:09 EDT (Thu, 31 Jul 2008)
New Revision: 19107
URL: https://svn.open-mpi.org/trac/ompi/changeset/19107

Log:
- Update the warn_unused result from allocating functions
- Set __opal_attribute_nonnull__ where an argument *must* not be null
- Mark unused functions


Text files modified:
  trunk/opal/util/argv.h     |     8 ++++----
  trunk/opal/util/cmd_line.c |     2 +-
  trunk/opal/util/cmd_line.h |    12 ++++++------
  3 files changed, 11 insertions(+), 11 deletions(-)

Modified: trunk/opal/util/argv.h
= = = = = = = = ======================================================================
--- trunk/opal/util/argv.h      (original)
+++ trunk/opal/util/argv.h      2008-07-31 11:46:09 EDT (Thu, 31 Jul 2008)
@@ -5,7 +5,7 @@
* Copyright (c) 2004-2005 The University of Tennessee and The University * of Tennessee Research Foundation. All rights
 *                         reserved.
- * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California.
 *                         All rights reserved.
@@ -162,9 +162,9 @@
   *
   * It is the callers responsibility to free the returned string.
   */
-OPAL_DECLSPEC char *opal_argv_join(char **argv, int delimiter) __opal_attribute_malloc__; +OPAL_DECLSPEC char *opal_argv_join(char **argv, int delimiter) __opal_attribute_malloc__ __opal_attribute_warn_unused_result__;

-OPAL_DECLSPEC char *opal_argv_join_range(char **argv, size_t start, size_t end, int delimiter) __opal_attribute_malloc__; +OPAL_DECLSPEC char *opal_argv_join_range(char **argv, size_t start, size_t end, int delimiter) __opal_attribute_malloc__ __opal_attribute_warn_unused_result__;

  /**
   * Return the number of bytes consumed by an argv array.
@@ -189,7 +189,7 @@
   * Specifically, the output argv will be an array of the same length
   * as the input argv, and strcmp(argv_in[i], argv_out[i]) will be 0.
   */
-OPAL_DECLSPEC char **opal_argv_copy(char **argv) __opal_attribute_malloc__; +OPAL_DECLSPEC char **opal_argv_copy(char **argv) __opal_attribute_malloc__ __opal_attribute_warn_unused_result__;

    /**
     * Delete one or more tokens from the middle of an argv.

Modified: trunk/opal/util/cmd_line.c
= = = = = = = = ======================================================================
--- trunk/opal/util/cmd_line.c  (original)
+++ trunk/opal/util/cmd_line.c 2008-07-31 11:46:09 EDT (Thu, 31 Jul 2008)
@@ -130,7 +130,7 @@
                        int *output_argc, char ***output_argv,
                        int *num_args_used, bool ignore_unknown);
static cmd_line_option_t *find_option(opal_cmd_line_t *cmd,
-                                      const char *option_name);
+ const char *option_name) __opal_attribute_nonnull__(1) __opal_attribute_nonnull__(2);
static void set_dest(cmd_line_option_t *option, char *sval);
static void fill(const cmd_line_option_t *a, char result[3][BUFSIZ]);
static int qsort_callback(const void *a, const void *b);

Modified: trunk/opal/util/cmd_line.h
= = = = = = = = ======================================================================
--- trunk/opal/util/cmd_line.h  (original)
+++ trunk/opal/util/cmd_line.h 2008-07-31 11:46:09 EDT (Thu, 31 Jul 2008)
@@ -5,7 +5,7 @@
* Copyright (c) 2004-2005 The University of Tennessee and The University * of Tennessee Research Foundation. All rights
 *                         reserved.
- * Copyright (c) 2004-2007 High Performance Computing Center Stuttgart, + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California.
 *                         All rights reserved.
@@ -416,7 +416,7 @@
     *
     * The returned string must be freed by the caller.
     */
- OPAL_DECLSPEC char *opal_cmd_line_get_usage_msg(opal_cmd_line_t *cmd); + OPAL_DECLSPEC char *opal_cmd_line_get_usage_msg(opal_cmd_line_t *cmd) __opal_attribute_malloc__ __opal_attribute_warn_unused_result__;

    /**
     * Test if a given option was taken on the parsed command line.
@@ -438,7 +438,7 @@
     * Otherwise, it will return false.
     */
    OPAL_DECLSPEC bool opal_cmd_line_is_taken(opal_cmd_line_t *cmd,
-                                              const char *opt);
+ const char *opt) __opal_attribute_nonnull__(1) __opal_attribute_nonnull__(2);

    /**
* Return the number of arguments parsed on a OPAL command line handle.
@@ -451,7 +451,7 @@
     * Arguments are added to the handle via the opal_cmd_line_parse()
     * function.
     */
-    OPAL_DECLSPEC int opal_cmd_line_get_argc(opal_cmd_line_t *cmd);
+ OPAL_DECLSPEC int opal_cmd_line_get_argc(opal_cmd_line_t *cmd) __opal_attribute_unused__;

    /**
     * Return a string argument parsed on a OPAL command line handle.
@@ -494,7 +494,7 @@
* handle, or opal_cmd_line_parse() was not invoked on this handle.
     */
    OPAL_DECLSPEC int opal_cmd_line_get_ninsts(opal_cmd_line_t *cmd,
-                                               const char *opt);
+ const char *opt) __opal_attribute_nonnull__(1) __opal_attribute_nonnull__(2);

    /**
     * Return a specific parameter for a specific instance of a option
@@ -556,7 +556,7 @@
     * to opal_argv_free()) by the caller.
     */
OPAL_DECLSPEC int opal_cmd_line_get_tail(opal_cmd_line_t *cmd, int *tailc,
-                                             char ***tailv);
+ char ***tailv) __opal_attribute_nonnull__(1) __opal_attribute_nonnull__(2);

#if defined(c_plusplus) || defined(__cplusplus)
}
_______________________________________________
svn-full mailing list
svn-f...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/svn-full


--
Jeff Squyres
Cisco Systems

Reply via email to