new IF_HAVE_PERL_5_16 convenience macro
[p5sagit/Function-Parameters.git] / Parameters.xs
index 53cb6bf..b822303 100644 (file)
@@ -61,6 +61,12 @@ WARNINGS_ENABLE
 #define HAVE_PERL_VERSION(R, V, S) \
        (PERL_REVISION > (R) || (PERL_REVISION == (R) && (PERL_VERSION > (V) || (PERL_VERSION == (V) && (PERL_SUBVERSION >= (S))))))
 
+#if HAVE_PERL_VERSION(5, 16, 0)
+ #define IF_HAVE_PERL_5_16(YES, NO) YES
+#else
+ #define IF_HAVE_PERL_5_16(YES, NO) NO
+#endif
+
 typedef struct {
        enum {
                FLAG_NAME_OPTIONAL = 1,
@@ -140,7 +146,6 @@ static int kw_flags(pTHX_ const char *kw_ptr, STRLEN kw_len, Spec *spec) {
 
 static int parse_fun(pTHX_ OP **pop, const char *keyword_ptr, STRLEN keyword_len, const Spec *spec) {
        SV *gen, *declarator, *params, *sv;
-       line_t line_start;
        int saw_name, saw_colon;
        STRLEN len;
        char *s;
@@ -150,7 +155,6 @@ static int parse_fun(pTHX_ OP **pop, const char *keyword_ptr, STRLEN keyword_len
        declarator = sv_2mortal(newSVpvn(keyword_ptr, keyword_len));
        params = sv_2mortal(newSVpvs(""));
 
-       line_start = CopLINE(PL_curcop);
        lex_read_space(0);
 
        /* function name */
@@ -234,7 +238,7 @@ static int parse_fun(pTHX_ OP **pop, const char *keyword_ptr, STRLEN keyword_len
                } else {
                        sv = sv_2mortal(newSVpvs(""));
                        if (!S_scan_str(aTHX_ sv, TRUE, TRUE)) {
-                               croak("In %"SVf": malformed prototype", SVfARG(declarator));
+                               croak("In %"SVf": prototype not terminated", SVfARG(declarator));
                        }
                        sv_catsv(gen, sv);
                        lex_read_space(0);
@@ -275,7 +279,7 @@ static int parse_fun(pTHX_ OP **pop, const char *keyword_ptr, STRLEN keyword_len
                        if (c == '(') {
                                sv = sv_2mortal(newSVpvs(""));
                                if (!S_scan_str(aTHX_ sv, TRUE, TRUE)) {
-                                       croak("In %"SVf": malformed attribute argument list", SVfARG(declarator));
+                                       croak("In %"SVf": unterminated attribute parameter in attribute list", SVfARG(declarator));
                                }
                                sv_catsv(gen, sv);
                                lex_read_space(0);