Merge pull request #381 from pfusik/static-forward-decl

"static" forward declarations
This commit is contained in:
Oliver Schmidt
2017-03-12 18:26:14 +01:00
committed by GitHub
7 changed files with 146 additions and 26 deletions

View 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;
}

View 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;
}

View 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;
}

View 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;
}

View 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;
}