This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH]: All unused functions and variables could be removed...


Let's testing...

************************************************************************

// File : g.c
#include <stdio.h>

static char AAAA[] = "ZZZZZZZZZzzzzzzzzzzzzzzz....."; //unused

void Test(void) // public, so ... used
{
  static char BBBB[] = "Testing........!!!!!!!!!!!?????????"; //unused
  char CCCC[] = "OOOOOOOOOOOOOOOOOOOOOOOOOOOOO"; //unused
}

static void No(void) //unused
{
  char DDDD[] = "XXXXXXXXXXXXXxxxxxxxxxxxxxxxxx......"; //unused
}


int main(void)
{
  char EEEE[] = "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!";
//unused
  int abc = 123; //unused
  static int def = 456; //unused
  int xyz = 789;
  int zzz = 111; //unused

  printf("%i\n", xyz);

  return 1;
}

************************************************************************

[root@CIH /tmp]# gcc.old g.c -o 1
[root@CIH /tmp]# ls -al 1
-rwxr-xr-x   1 root     root        12203 Jan  5 13:00 1
[root@CIH /tmp]# nm 1 | grep AAAA
080495e0 d AAAA
[root@CIH /tmp]# nm 1 | grep BBBB
08049600 d BBBB.3
[root@CIH /tmp]# nm 1 | grep Test
080483f0 T Test
[root@CIH /tmp]# nm 1 | grep No
08048418 t No
[root@CIH /tmp]# gcc.new g.c -o 2
[root@CIH /tmp]# ls -al 2
-rwxr-xr-x   1 root     root        11749 Jan  5 13:01 2
[root@CIH /tmp]# nm 2 | grep AAAA
[root@CIH /tmp]# nm 2 | grep BBBB
[root@CIH /tmp]# nm 2 | grep Test
080483f0 T Test
[root@CIH /tmp]# nm 2 | grep No

************************************************************************

Any questions, please EMail :   CIH@wahoo.com.tw or CIH@xlinux.com

^o^

************************************************************************


gcc-2.95.2.diff.tar.gz


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]