summaryrefslogtreecommitdiff
path: root/experimental/frisch/test_ifdef.ml
blob: 4b7eafb344a5edb2e3e52de5e3336f90d7bb235d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
type t =
  | A
  | DBG [@IFDEF DEBUG] of string
  | B

[%%IFDEF DEBUG]
let debug s = prerr_endline ([%GETENV DEBUG] ^ ":" ^ s)
let x = DBG "xxx"
[%%ELSE]
let debug _ = ()
let x = A
[%%END]

let f = function
  | A -> "A"
  | DBG s when [%IFDEF DEBUG] -> "DEBUG:" ^ s
  | B -> "B"

let () = debug "ABC"

let () =
  Printf.printf "compiled by user %s in directory %s\n%!"
    [%GETENV USER]
    [%GETENV PWD]