mirror of
https://github.com/cc65/cc65.git
synced 2024-12-27 00:29:31 +00:00
Added regression tests of diagnostics for conflicts between extern/public and static declarations.
This commit is contained in:
parent
6032849e60
commit
1baecf4a15
20
test/err/static-2.c
Normal file
20
test/err/static-2.c
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
!!DESCRIPTION!! global non-static and static conflicts
|
||||
!!ORIGIN!! cc65 regression tests
|
||||
!!LICENCE!! Public Domain
|
||||
!!AUTHOR!! Greg King
|
||||
*/
|
||||
|
||||
/*
|
||||
see: https://github.com/cc65/cc65/issues/191
|
||||
*/
|
||||
|
||||
#pragma warn(error, on)
|
||||
|
||||
int n;
|
||||
static int n; /* should give an error */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return n;
|
||||
}
|
20
test/err/static-3.c
Normal file
20
test/err/static-3.c
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
!!DESCRIPTION!! global non-static and static conflicts
|
||||
!!ORIGIN!! cc65 regression tests
|
||||
!!LICENCE!! Public Domain
|
||||
!!AUTHOR!! Greg King
|
||||
*/
|
||||
|
||||
/*
|
||||
see: https://github.com/cc65/cc65/issues/191
|
||||
*/
|
||||
|
||||
#pragma warn(error, on)
|
||||
|
||||
extern int n;
|
||||
static int n; /* should give an error */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return n;
|
||||
}
|
20
test/err/static-4.c
Normal file
20
test/err/static-4.c
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
!!DESCRIPTION!! global non-static and static conflicts
|
||||
!!ORIGIN!! cc65 regression tests
|
||||
!!LICENCE!! Public Domain
|
||||
!!AUTHOR!! Greg King
|
||||
*/
|
||||
|
||||
/*
|
||||
see: https://github.com/cc65/cc65/issues/191
|
||||
*/
|
||||
|
||||
#pragma warn(error, on)
|
||||
|
||||
static int n;
|
||||
int n; /* should give an error */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return n;
|
||||
}
|
20
test/val/static-1.c
Normal file
20
test/val/static-1.c
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
!!DESCRIPTION!! global non-static and static conflicts
|
||||
!!ORIGIN!! cc65 regression tests
|
||||
!!LICENCE!! Public Domain
|
||||
!!AUTHOR!! Greg King
|
||||
*/
|
||||
|
||||
/*
|
||||
see: https://github.com/cc65/cc65/issues/191
|
||||
*/
|
||||
|
||||
#pragma warn(error, on)
|
||||
|
||||
static int n = 0;
|
||||
extern int n; /* should not give an error */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return n;
|
||||
}
|
Loading…
Reference in New Issue
Block a user