source: trunk/testcase/weak/weak3.c@ 1170

Last change on this file since 1170 was 484, checked in by bird, 22 years ago

playing.

  • Property cvs2svn:cvs-rev set to 1.5
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 724 bytes
RevLine 
[476]1/* Example on weak aliasing as found in some GCC manual:
2 * http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
3 */
4
[482]5/* GCC Style */
[477]6int __f ()
[476]7{
8 return 1;
9}
[477]10int f () __attribute__ ((weak, alias ("__f")));
[476]11
[482]12
13/* SUN style */
14extern int WeakExternalWithLocalDefault();
15int LocalDefault()
16{
17 return -1;
18}
[484]19#pragma weak WeakExternalWithLocalDefault = LocalDefault
[482]20
21
[484]22/* This doesn't work in GCC, though it's the only thing which works in VAC. */
[482]23extern int ExternalDefault();
24extern int WeakExternalWithLocalDefault();
[484]25#pragma weak WeakExternalWithExternalDefault = ExternalDefault
[482]26
27
28
29int main()
30{
31 int rc;
32
33 rc = WeakExternalWithLocalDefault();
34 rc += WeakExternalWithExternalDefault();
35
36 return rc;
37}
Note: See TracBrowser for help on using the repository browser.