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

Last change on this file since 596 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
Line 
1/* Example on weak aliasing as found in some GCC manual:
2 * http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
3 */
4
5/* GCC Style */
6int __f ()
7{
8 return 1;
9}
10int f () __attribute__ ((weak, alias ("__f")));
11
12
13/* SUN style */
14extern int WeakExternalWithLocalDefault();
15int LocalDefault()
16{
17 return -1;
18}
19#pragma weak WeakExternalWithLocalDefault = LocalDefault
20
21
22/* This doesn't work in GCC, though it's the only thing which works in VAC. */
23extern int ExternalDefault();
24extern int WeakExternalWithLocalDefault();
25#pragma weak WeakExternalWithExternalDefault = ExternalDefault
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.