These are chat archives for Snaipe/Criterion

16th
Feb 2016
Dominik
@kaidowei
Feb 16 2016 10:11
@Snaipe hi again, do you have a quick fix for the following:
test_all.c: In function ‘another_suite_test_stdout_impl’:
test_all.c:43:140: warning: zero-length gnu_printf format string [-Wformat-zero-length]
cr_assert_stdout_eq_str("foo");
^
test_all.c:47:140: warning: zero-length gnu_printf format string [-Wformat-zero-length]
cr_assert_stderr_eq_str("bar");
Dominik
@kaidowei
Feb 16 2016 10:16

btw. I was thinking about the default message:
[----] test_all.c:30: Assertion failed: The expression (as strings) (s) != ("hello") is false.

Something like "The expession (as strings) (s) != ("hello") is false. (s == "something_not_hello").

or even better expand both arguments, maybe the user has some variable for expected too
The expession (as strings) (s) != ("hello") is false. (actual = 'something_else', expected = 'hello')
with a check for null obviously
Franklin Mathieu
@Snaipe
Feb 16 2016 12:42
@kaidowei the first warnings are weird, they should be suppressed by pragmas already
Dominik
@kaidowei
Feb 16 2016 12:44
Okay, can I help to fix this?
Franklin Mathieu
@Snaipe
Feb 16 2016 12:44
as for the parameter expansion, it should be possible. I wasn't doing anything more than printing the parameters because there was no generic way to print two variables as strings in C, but I'll do it at least for strings
(and maybe think about actually printing something if _Generic is available)
As for fixing the warning, does cr_assert(0) yield any warning for you?
Dominik
@kaidowei
Feb 16 2016 12:47
test_all.c:23:77: warning: zero-length gnu_printf format string [-Wformat-zero-length]
cr_assert(0);
^
yes
Franklin Mathieu
@Snaipe
Feb 16 2016 12:47
What compiler (+version) are you using?
Dominik
@kaidowei
Feb 16 2016 12:50
gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.1) 4.8.4
Franklin Mathieu
@Snaipe
Feb 16 2016 12:58
@kaidowei just for the sake of it, does putting #pragma GCC diagnostic ignored "-Wformat-zero-length" on the top of your test file suppresses the warning?
Dominik
@kaidowei
Feb 16 2016 13:10
yes it does
Dominik
@kaidowei
Feb 16 2016 13:17
as for the parameter expansion, it should be possible. I wasn't doing anything more than printing the parameters because there was no generic way to print two variables as strings in C, but I'll do it at least for strings
thanks, will work for pointer and floats too :)
Franklin Mathieu
@Snaipe
Feb 16 2016 13:17
@kaidowei could you try to apply this patch and tell me if it fixes anything?
Dominik
@kaidowei
Feb 16 2016 13:21
nope, does not fix it
ah wait... let me check again
our build process cleans everything...
nope, sorry, still there with the patch
Franklin Mathieu
@Snaipe
Feb 16 2016 13:35
I'm not sure why the pragma isn't picked up. Try this patch and tell me what errors you are hitting.
(reset any changes made by the 1rst patch)
Franklin Mathieu
@Snaipe
Feb 16 2016 13:43
So the pragmas are indeed hit. WTF?
I'm going to grab gcc 4.8.4 and do some more tests
Dominik
@kaidowei
Feb 16 2016 13:53
good, will be able to respond for 3-4 hours
Dominik
@kaidowei
Feb 16 2016 15:24

fyi with gcc --version
gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2

it works

Franklin Mathieu
@Snaipe
Feb 16 2016 15:26
Thanks -- I'm currently building gcc 4.8 to see why this is happening.
Franklin Mathieu
@Snaipe
Feb 16 2016 16:33
@kaidowei from what I'm seeing, this is a bug with GCC
I'm currently producing a patch to avoid having empty format strings in the first place
Dominik
@kaidowei
Feb 16 2016 16:33
wow, cool
thanks for the effort :)
Franklin Mathieu
@Snaipe
Feb 16 2016 16:33
so the warning (and dirty pragma hack) should dissappear for good
No problem :)
Franklin Mathieu
@Snaipe
Feb 16 2016 16:42
@kaidowei I just pushed a fix on the patch branch, could you confirm it works?
This message was deleted
Franklin Mathieu
@Snaipe
Feb 16 2016 16:50
(can't seem to reproduce it on my end on gcc 4.8.5, so I'd say it is 4.8.4-specific)
Dominik
@kaidowei
Feb 16 2016 17:28
@Snaipe seems to work
the naming patch is also appreciated
thanks!
Franklin Mathieu
@Snaipe
Feb 16 2016 18:03
Perfect then. If there aren't any more issues in the next few days, I'll consider releasing v2.2.1.
Dominik
@kaidowei
Feb 16 2016 18:04
I'll let you know, if I find anything.