Skip to content

Commit 606f25b

Browse files
Chris00jeremiedimino
authored andcommitted
Configurator: handle negative numbers (ocaml#1334)
Signed-off-by: Christophe Troestler <[email protected]>
1 parent 4d059d2 commit 606f25b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ next
44
- Do not fail if the output of `ocamlc -config` doesn't include
55
`standard_runtime` (#...., @diml)
66

7+
- Let `Configurator.V1.C_define.import` handle negative integers
8+
(@Chris00)
9+
710
1.3.0 (23/09/2018)
811
------------------
912

src/configurator/v1.ml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,14 @@ module C_define = struct
366366
pr {|
367367
const char s%i[] = {
368368
'B', 'E', 'G', 'I', 'N', '-', %s'-',
369+
#if %s >= 0
369370
D9((%s)),
371+
#else
372+
'-', D9((- %s)),
373+
#endif
370374
'-', 'E', 'N', 'D'
371375
};
372-
|} i c_arr_i name
376+
|} i c_arr_i name name name
373377
| String ->
374378
pr {|const char *s%i = "BEGIN-%i-" %s "-END";|} i i name;
375379
| Switch ->

0 commit comments

Comments
 (0)