~ubuntu-branches/ubuntu/feisty/unifdef/feisty

« back to all changes in this revision

Viewing changes to tests/if4.c

  • Committer: Bazaar Package Importer
  • Author(s): Bob Proulx
  • Date: 2004-07-03 18:09:39 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040703180939-iv7azs869mqz47p8
Tags: 1.0+20030701-1
* Switch to current FreeBSD version version of unifdef.  This is
  effectively a switch to a new upstream version.  Really it is
  switching to a different branching of the original code base.
* Suggestion to switch to the newer FreeBSD version. (Closes: #234054)
* Whitespace is now allowed at the beginning of #if line before the '#'
  character.  (Closes: #204349)
* Whitespace is now generally ignored around the preprocessor
  directives.  This allows indention of preprocessor control flow.
* Previously only "#ifdef" and "#ifndef" preprocessor controls were
  handled giving the program the justifiable name of "unifdef".  Now
  general "#if" processing such as "#if defined(FOO)" and boolean
  expresions of those constructs are allowed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdio.h>
 
2
#include <stdlib.h>
 
3
 
 
4
#if defined(FOO) || defined(FOOB)
 
5
int foo1() { return 0; }
 
6
#else
 
7
#error FOO or FOOB not defined
 
8
#endif
 
9
 
 
10
#if defined(FOOB) || defined(FOO)
 
11
int foo2() { return 0; }
 
12
#else
 
13
#error FOO or FOOB not defined
 
14
#endif
 
15
 
 
16
#if defined(FOO) && defined(FOOB)
 
17
int foo3() { return 0; }
 
18
#else
 
19
#error FOO and FOOB not defined
 
20
#endif
 
21
 
 
22
#if defined(FOOB) && defined(FOO)
 
23
int foo4() { return 0; }
 
24
#else
 
25
#error FOO and FOOB not defined
 
26
#endif
 
27
 
 
28
int main()
 
29
{
 
30
  foo1();
 
31
  foo2();
 
32
  foo3();
 
33
  foo4();
 
34
}