From 131034eceddbe7db95313ce43c1292811e4b4c54 Mon Sep 17 00:00:00 2001 From: Dmitry Podgorny Date: Sun, 24 Mar 2013 18:15:43 +0200 Subject: Add -Werror only for development builds --- configure.ac | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 45badb0e..ceaf1751 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,8 @@ AC_PREREQ([2.65]) AC_INIT([profanity], [0.3.0], [boothj5web@gmail.com]) -AC_DEFINE([PACKAGE_STATUS], ["development"], [Status of this build]) +PACKAGE_STATUS="development" +AC_DEFINE_UNQUOTED([PACKAGE_STATUS], ["$PACKAGE_STATUS"], [Status of this build]) AC_CONFIG_SRCDIR([src/main.c]) AC_CONFIG_HEADERS([src/config.h]) AC_CONFIG_AUX_DIR([build-aux]) @@ -87,7 +88,10 @@ if test "x$enable_notifications" != xno; then fi # Default parameters -AM_CFLAGS="-Wall -Werror" +AM_CFLAGS="-Wall" +if test "x$PACKAGE_STATUS" = xdevelopment; then + AM_CFLAGS="$AM_CFLAGS -Wunused -Werror" +fi LIBS="$LIBS $DEPS_LIBS $NOTIFY_LIBS" AM_CPPFLAGS="$DEPS_CFLAGS $NOTIFY_CFLAGS" -- cgit 1.4.1-2-gfad0 thorough tests → More comprehensible and rewrite-friendly software → More resilient society.Kartik K. Agaram <vc@akkartik.com>
about summary refs log tree commit diff stats
path: root/continuation5.mu
blob: 295cb9c9112d0e071aff5b155bcab7d29c9606f8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Example program showing that a 'paused' continuation can be 'resumed' with
# inputs.
#
# Print out a list of numbers, first adding 0 to the first, 1 to the second, 2
# to the third, and so on.
#
# To run:
#   $ git clone https://github.com/akkartik/mu
#   $ cd mu
#   $ ./mu continuation5.mu
#
# Expected output:
#   1
#   3
#   5

def main [
  local-scope
  l:&:list:num <- copy null
  l <- push 3, l
  l <- push 2, l
  l <- push 1, l
  k:continuation, x:num, done?:bool <- call-with-continuation-mark 100/mark, create-yielder, l
  a:num <- copy 1
  {
    break-if done?
    $print x 10/newline
    k, x:num, done?:bool <- call k, a  # resume; x = a + next l value
    a <- add a, 1
    loop
  }
]

def create-yielder l:&:list:num -> n:num, done?:bool [
  local-scope
  load-inputs
  a:num <- copy 0
  {
    done? <- equal l, null
    break-if done?
    n <- first l
    l <- rest l
    n <- add n, a
    a <- return-continuation-until-mark 100/mark, n, done?  # pause/resume
    loop
  }
  return-continuation-until-mark 100/mark, -1, done?
  assert false, [called too many times, ran out of continuations to return]
]