Merge pull request #381 from pfusik/static-forward-decl
"static" forward declarations
This commit is contained in:
18
test/err/duplicate-global-static.c
Normal file
18
test/err/duplicate-global-static.c
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
!!DESCRIPTION!! global duplicated with static variable
|
||||
!!ORIGIN!! cc65 regression tests
|
||||
!!LICENCE!! Public Domain
|
||||
!!AUTHOR!! Piotr Fusik
|
||||
*/
|
||||
|
||||
/*
|
||||
see: https://github.com/cc65/cc65/issues/191
|
||||
*/
|
||||
|
||||
int n = 0;
|
||||
static int n = 0; /* should give an error */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return n;
|
||||
}
|
||||
20
test/err/duplicate-global.c
Normal file
20
test/err/duplicate-global.c
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
!!DESCRIPTION!! duplicate globals
|
||||
!!ORIGIN!! cc65 regression tests
|
||||
!!LICENCE!! Public Domain
|
||||
!!AUTHOR!! Piotr Fusik
|
||||
*/
|
||||
|
||||
/*
|
||||
see: https://github.com/cc65/cc65/issues/191
|
||||
*/
|
||||
|
||||
#pragma warn(error, on)
|
||||
|
||||
int n = 0;
|
||||
int n = 0; /* should give an error */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return n;
|
||||
}
|
||||
18
test/err/duplicate-static-global.c
Normal file
18
test/err/duplicate-static-global.c
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
!!DESCRIPTION!! static duplicated with global variable
|
||||
!!ORIGIN!! cc65 regression tests
|
||||
!!LICENCE!! Public Domain
|
||||
!!AUTHOR!! Piotr Fusik
|
||||
*/
|
||||
|
||||
/*
|
||||
see: https://github.com/cc65/cc65/issues/191
|
||||
*/
|
||||
|
||||
static int n = 0;
|
||||
int n = 0; /* should give an error */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return n;
|
||||
}
|
||||
20
test/err/duplicate-static.c
Normal file
20
test/err/duplicate-static.c
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
!!DESCRIPTION!! duplicate static variables
|
||||
!!ORIGIN!! cc65 regression tests
|
||||
!!LICENCE!! Public Domain
|
||||
!!AUTHOR!! Piotr Fusik
|
||||
*/
|
||||
|
||||
/*
|
||||
see: https://github.com/cc65/cc65/issues/191
|
||||
*/
|
||||
|
||||
#pragma warn(error, on)
|
||||
|
||||
static int n = 0;
|
||||
static int n = 0; /* should give an error */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return n;
|
||||
}
|
||||
35
test/val/static-fwd-decl.c
Normal file
35
test/val/static-fwd-decl.c
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
!!DESCRIPTION!! static forward declarations
|
||||
!!ORIGIN!! cc65 regression tests
|
||||
!!LICENCE!! Public Domain
|
||||
!!AUTHOR!! Bob Andrews
|
||||
*/
|
||||
|
||||
/*
|
||||
see: https://github.com/cc65/cc65/issues/204
|
||||
*/
|
||||
|
||||
#pragma warn(error, on)
|
||||
|
||||
typedef struct _DIRMENU
|
||||
{
|
||||
const char *name;
|
||||
struct _DIRMENU *dest;
|
||||
} DIRMENU;
|
||||
|
||||
static DIRMENU rmenu;
|
||||
|
||||
static DIRMENU lmenu = {
|
||||
"left",
|
||||
&rmenu
|
||||
};
|
||||
|
||||
static DIRMENU rmenu = {
|
||||
"right",
|
||||
&lmenu
|
||||
};
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return lmenu.dest == &rmenu && rmenu.dest == &lmenu ? 0 : 1;
|
||||
}
|
||||
Reference in New Issue
Block a user