All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Torsten Bögershausen" <tboegi@web.de>
To: sortie@maxsi.org, Git Mailing List <git@vger.kernel.org>
Subject: progress.c does not compile under Mac OS X
Date: Sat, 30 Aug 2014 22:37:00 +0200	[thread overview]
Message-ID: <540235EC.2020303@web.de> (raw)

progress.c:66: error: ‘CLOCK_MONOTONIC’ undeclared (first use in this function)

You can not cast a undeclared into void in git-compat-uitl.h:
#define timer_create(clockid, sevp, timerp) ((void) (clockid), (void) (sevp), (void) (timerp), errno 


Removing the cast of a define into (void) makes the compilation error in line 66 go away:
 #ifdef NO_TIMER_SETTIME
-#define timer_create(clockid, sevp, timerp) ((void) (clockid), (void) (sevp), (void) (timerp), errno = ENOSYS, -1)
+#define timer_create(clockid, sevp, timerp) ((void) (sevp), (void) (timerp), errno = ENOSYS, -1)
 
But now we have a bunch of other problems:

progress.c:71: warning: assignment makes integer from pointer without a cast
progress.c:71: error: invalid operands to binary / (have ‘long int *’ and ‘long int’)
progress.c:71: warning: statement with no effect
progress.c:71: error: ‘_ivalue_it_value’ undeclared (first use in this function)
progress.c:71: error: (Each undeclared identifier is reported only once
progress.c:71: error: for each function it appears in.)
progress.c:71: error: invalid operands to binary / (have ‘long int *’ and ‘long int’)
progress.c:74: error: expected ‘while’ before ‘static’
progress.c:82: error: nested functions are disabled, use -fnested-functions to re-enable
progress.c:82: error: invalid storage class for function ‘display’
progress.c: In function ‘display’:
progress.c:92: warning: implicit declaration of function ‘clear_progress_signal’
progress.c: In function ‘set_progress_signal’:
progress.c:126: error: nested functions are disabled, use -fnested-functions to re-enable
progress.c:126: error: invalid storage class for function ‘throughput_string’
progress.c:135: error: nested functions are disabled, use -fnested-functions to re-enable
progress.c:199: error: nested functions are disabled, use -fnested-functions to re-enable
progress.c:205: error: nested functions are disabled, use -fnested-functions to re-enable
progress.c:225: error: nested functions are disabled, use -fnested-functions to re-enable
progress.c:230: error: nested functions are disabled, use -fnested-functions to re-enable
progress.c:235: error: nested functions are disabled, use -fnested-functions to re-enable
progress.c:264: error: expected declaration or statement at end of input


----------------
And then we have the question why we do not check the return value of timer_create() in progress.c#66:

timer_create(CLOCK_MONOTONIC, &sev, &progress_timer);

value.it_interval.tv_sec = 1;
value.it_interval.tv_nsec = 0;
value.it_value = value.it_interval;
timer_settime(progress_timer, 0, &value, NULL);
--------------
Should it be something like this ?
if (!timer_create(CLOCK_MONOTONIC, &sev, &progress_timer)) {
  value.it_interval.tv_sec = 1;
  value.it_interval.tv_nsec = 0;
  value.it_value = value.it_interval;
  timer_settime(progress_timer, 0, &value, NULL);
}

(And possibly more changes to handle errors when calling
timer_delete(progress_timer)


(Sorry, no, I don't have a patch at hand.
 It feels as if the macros in git-compat-util.h could be converted into real functions,
 in compat/timer_settime.c (or so) so that we can test-compile under Linux)

             reply	other threads:[~2014-08-30 20:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-30 20:37 Torsten Bögershausen [this message]
2014-08-30 23:12 ` progress.c does not compile under Mac OS X Jonas 'Sortie' Termansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=540235EC.2020303@web.de \
    --to=tboegi@web.de \
    --cc=git@vger.kernel.org \
    --cc=sortie@maxsi.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.