Quantcast
Channel: Intel® Software - Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 2797

Missing support for returns_nonnull attribute

$
0
0

It looks like ICC is missing support for the retuns_nonnull attribute (tested up to 19.0.1), which has been present in GCC since 4.9.  Here is a quick test case:

#include <stdio.h>

static const char* foo = "bar\n";

#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)))
__attribute__((__returns_nonnull__))
#endif
static const char* get_string(void) {
  return foo;
}

int main(void) {
  const char* s = get_string();
  if (s != NULL)
    fputs(s, stdout);
  else
    fputs("This shouldn't happen\n", stdout);

  return 0;
}

Viewing all articles
Browse latest Browse all 2797

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>