Merge branch 'improvement-i172' of https://github.com/YashasSamaga/pawn
This commit is contained in:
commit
1fbc474543
@ -3917,6 +3917,8 @@ static int declargs(symbol *sym,int chkshadow)
|
|||||||
case '&':
|
case '&':
|
||||||
if (ident!=iVARIABLE || numtags>0)
|
if (ident!=iVARIABLE || numtags>0)
|
||||||
error(1,"-identifier-","&");
|
error(1,"-identifier-","&");
|
||||||
|
if (fconst)
|
||||||
|
error(238, "const reference"); /* meaningless combination of class specifiers */
|
||||||
ident=iREFERENCE;
|
ident=iREFERENCE;
|
||||||
break;
|
break;
|
||||||
case tCONST:
|
case tCONST:
|
||||||
@ -3991,6 +3993,8 @@ static int declargs(symbol *sym,int chkshadow)
|
|||||||
case tELLIPS:
|
case tELLIPS:
|
||||||
if (ident!=iVARIABLE)
|
if (ident!=iVARIABLE)
|
||||||
error(10); /* illegal function or declaration */
|
error(10); /* illegal function or declaration */
|
||||||
|
if (fconst)
|
||||||
|
error(238, "const variable arguments"); /* meaningless combination of class specifiers */
|
||||||
if (numtags==0)
|
if (numtags==0)
|
||||||
tags[numtags++]=0; /* default tag */
|
tags[numtags++]=0; /* default tag */
|
||||||
if ((sym->usage & uPROTOTYPED)==0) {
|
if ((sym->usage & uPROTOTYPED)==0) {
|
||||||
|
@ -191,7 +191,8 @@ static char *warnmsg[] = {
|
|||||||
/*234*/ "function is deprecated (symbol \"%s\") %s\n",
|
/*234*/ "function is deprecated (symbol \"%s\") %s\n",
|
||||||
/*235*/ "public function lacks forward declaration (symbol \"%s\")\n",
|
/*235*/ "public function lacks forward declaration (symbol \"%s\")\n",
|
||||||
/*236*/ "unknown parameter in substitution (incorrect #define pattern)\n",
|
/*236*/ "unknown parameter in substitution (incorrect #define pattern)\n",
|
||||||
/*237*/ "user warning: %s\n"
|
/*237*/ "user warning: %s\n",
|
||||||
|
/*238*/ "meaningless combination of class specifiers (%s)\n"
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NUM_WARNINGS (sizeof warnmsg / sizeof warnmsg[0])
|
#define NUM_WARNINGS (sizeof warnmsg / sizeof warnmsg[0])
|
||||||
|
@ -48,6 +48,12 @@ set_tests_properties(gh_283 PROPERTIES PASS_REGULAR_EXPRESSION "\
|
|||||||
add_compiler_test(too_many_args_crash_gh_298 ${CMAKE_CURRENT_SOURCE_DIR}/too_many_args_crash_gh_298.pwn)
|
add_compiler_test(too_many_args_crash_gh_298 ${CMAKE_CURRENT_SOURCE_DIR}/too_many_args_crash_gh_298.pwn)
|
||||||
set_tests_properties(too_many_args_crash_gh_298 PROPERTIES PASS_REGULAR_EXPRESSION "too many function arguments")
|
set_tests_properties(too_many_args_crash_gh_298 PROPERTIES PASS_REGULAR_EXPRESSION "too many function arguments")
|
||||||
|
|
||||||
|
add_compiler_test(meaningless_class_specifiers_gh_172 ${CMAKE_CURRENT_SOURCE_DIR}/meaningless_class_specifiers_gh_172.pwn)
|
||||||
|
set_tests_properties(meaningless_class_specifiers_gh_172 PROPERTIES PASS_REGULAR_EXPRESSION "\
|
||||||
|
.*\\.pwn\\(1\\) : warning 238: meaningless combination of class specifiers \\(const reference\\)\
|
||||||
|
.*\\.pwn\\(1 \\-\\- 2\\) : warning 238: meaningless combination of class specifiers \\(const variable arguments\\)\
|
||||||
|
")
|
||||||
|
|
||||||
# Crashers
|
# Crashers
|
||||||
#
|
#
|
||||||
# These tests simply check that the compiler doesn't crash.
|
# These tests simply check that the compiler doesn't crash.
|
||||||
|
20
source/compiler/tests/meaningless_class_specifiers_gh_172.pwn
Executable file
20
source/compiler/tests/meaningless_class_specifiers_gh_172.pwn
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
f1(const &v) { }
|
||||||
|
f2(const ...) { }
|
||||||
|
f3(const v) {
|
||||||
|
#pragma unused v
|
||||||
|
}
|
||||||
|
f4(...) { }
|
||||||
|
f5(v) {
|
||||||
|
#pragma unused v
|
||||||
|
}
|
||||||
|
f6(&v) { }
|
||||||
|
|
||||||
|
main() {
|
||||||
|
new a;
|
||||||
|
f1(a);
|
||||||
|
f2(a);
|
||||||
|
f3(a);
|
||||||
|
f4(a);
|
||||||
|
f5(a);
|
||||||
|
f6(a);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user