# New Ticket Created by "Rob West" # Please include the string: [perl #46473] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=46473 >
This patch should make it so that the NOTNULL macro will work as expected for a compiler that supports __attribute__((__nonnull__)) like gcc. Same for PARROT_MALLOC and __attribute__((__malloc__)). It also surrounds the attribute names with double underscores (as allowed by gcc). "This allows you to use them in header files without being concerned about a possible macro of the same name." ==== Patch <attributes_fix> level 1 Source: [No source] Target: d31e2699-5ff4-0310-a27c-f18f2fbe73fe:/trunk:22138 [mirrored] (https://svn.perl.org/parrot/trunk) Log: Fix configure to correctly verify whether the malloc, format, and nonnull attributes are supported === config/auto/attributes/test_c.in ================================================================== --- config/auto/attributes/test_c.in (revision 22138) +++ config/auto/attributes/test_c.in (patch attributes_fix level 1) @@ -12,9 +12,9 @@ __attribute__noreturn__ __attribute__warn_unused_result__ __attribute__deprecated__ -int -dummyfunc(int x) - __attribute__format__(1,2,3) +void * +dummyfunc(const char *my_format, ...) + __attribute__format__(printf,1,2) __attribute__nonnull__(1) ; === include/parrot/compiler.h ================================================================== --- include/parrot/compiler.h (revision 22138) +++ include/parrot/compiler.h (patch attributes_fix level 1) @@ -23,36 +23,36 @@ # ifdef _MSC_VER # define __attribute__deprecated__ __declspec(deprecated) # else -# define __attribute__deprecated__ __attribute__((deprecated)) +# define __attribute__deprecated__ __attribute__((__deprecated__)) # endif #endif #ifdef HASATTRIBUTE_FORMAT -# define __attribute__format__(x,y,z) __attribute__((format(x,y,z))) +# define __attribute__format__(x,y,z) __attribute__((__format__(x,y,z))) #endif #ifdef HASATTRIBUTE_MALLOC # define __attribute__malloc__ __attribute__((__malloc__)) #endif #ifdef HASATTRIBUTE_NONNULL -# define __attribute__nonnull__(a) __attribute__((nonnull(a))) +# define __attribute__nonnull__(a) __attribute__((__nonnull__(a))) #endif #ifdef HASATTRIBUTE_NORETURN # ifdef _MSC_VER # define __attribute__noreturn__ __declspec(noreturn) # else -# define __attribute__noreturn__ __attribute__((noreturn)) +# define __attribute__noreturn__ __attribute__((__noreturn__)) # endif #endif #ifdef HASATTRIBUTE_PURE -# define __attribute__pure__ __attribute__((pure)) +# define __attribute__pure__ __attribute__((__pure__)) #endif #ifdef HASATTRIBUTE_CONST -# define __attribute__const__ __attribute__((const)) +# define __attribute__const__ __attribute__((__const__)) #endif #ifdef HASATTRIBUTE_UNUSED -# define __attribute__unused__ __attribute__((unused)) +# define __attribute__unused__ __attribute__((__unused__)) #endif #ifdef HASATTRIBUTE_WARN_UNUSED_RESULT -# define __attribute__warn_unused_result__ __attribute__((warn_unused_result)) +# define __attribute__warn_unused_result__ __attribute__((__warn_unused_result__)) #endif /* If we haven't defined the attributes yet, define them to blank. */