Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no fdatasync on FreeBSD platform (possible other BSDs), CLANG warning about incompatible type of VERSION #10

Closed
GoogleCodeExporter opened this issue Mar 29, 2015 · 5 comments

Comments

@GoogleCodeExporter
Copy link

Compilation of ioping v0.7 is broken under FreeBSD with follow error:

--
ioping.c:579:17: warning: implicit declaration of function 'fdatasync' is 
invalid in C99 [-Wimplicit-function-declaration]
        if (!cached && fdatasync(fd) < 0)
                       ^
2 warnings generated.
/tmp/ioping-QYo1BH.o: In function `do_pwrite':
ioping.c:(.text+0xb16): undefined reference to `fdatasync'
--

cause there no fdatasync functions. fsync(2) must be used instead.


Also, CLANG out the warning about incompatible format for VERSION variable:

--
ioping.c:225:33: warning: format specifies type 'char *' but the argument has 
type 'double' [-Wformat]
        fprintf(stderr, "ioping %s\n", VERSION);
                                ~~     ^~~~~~~
                                %f
<command line>:1:17: note: expanded from here
#define VERSION 0.7
                ^~~
--


Ive don't know what is correct solution to fix this:

-- fprintf(stderr, "ioping %f\n", VERSION);
++ fprintf(stderr, "ioping %f\n", VERSION);

or

-- #define VERSION 0.7
++ #define VERSION "0.7"

or  (char *)VERSION

Temporary ive apply %f type for fprintf.

Please review attached patch.


Original issue reported on code.google.com by oleg.gin...@nevosoft.ru on 23 Jul 2013 at 12:18

Attachments:

@GoogleCodeExporter
Copy link
Author

FreeBSD really still doesn't have fdatasync? Try patch from git.

VERSION came from Makefile where it's defined as string contant: 
-DVERSION=\"${VERSION}\"
So probably this doesn't work with your 'make'. Please try normal gnu make.


Original comment by koct9i on 24 Jul 2013 at 7:04

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

On Wednesday 24 July 2013 19:04:15 you wrote:

Thanks, patch works for me. 

I'm not sure that the root of problem in "not gnu" make, as it is the compiler 
generates a warning. A short example on MacOSX 10.8.3 Mountain Lion:

mac-builder$ cat test.c
#include <stdio.h>

#define TEST 0.1

int main()
{
printf("%s",TEST);
}



mac-builder$ cc test.c 
test.c:8:10: warning: format specifies type 'char *' but the argument has type 
'double' [-Wformat]
printf("%s",TEST);
        ~^  ~~~~
        %f
1 warning generated.


mac-builder$ cc -v
Apple clang version 4.0 (tags/Apple/clang-421.0.60) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin12.3.0
Thread model: posix

Original comment by oleg.gin...@nevosoft.ru on 24 Jul 2013 at 8:10

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

VERSION must be defined as string "0.7" not as float 0.7
Escaped quotation marks in makefile must be part of it.

Original comment by koct9i on 24 Jul 2013 at 8:15

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

Ok. Thank you for detail. Please close this ticket.

Original comment by oleg.gin...@nevosoft.ru on 24 Jul 2013 at 8:26

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

Original comment by koct9i on 25 Jul 2013 at 5:52

  • Changed state: Fixed
  • Added labels: ****
  • Removed labels: ****

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant