Hello, please see trivial patch attached which fixes compiler warnings:
../src/tests/cmocka/test_sysdb_views.c: In function ‘test_sysdb_add_overrides_to_object_local’: ../src/tests/cmocka/test_sysdb_views.c:307:33: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] test_ctx->domain->view_name = "LOCAL"; ^ ../src/tests/cmocka/test_sysdb_views.c:288:33: error: unused variable ‘el’ [-Werror=unused-variable] struct ldb_message_element *el; ^ ../src/tests/cmocka/test_sysdb_views.c: In function ‘test_sysdb_add_overrides_to_object_missing_overridedn’: ../src/tests/cmocka/test_sysdb_views.c:340:33: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] test_ctx->domain->view_name = "NON-LOCAL"; ^ ../src/tests/cmocka/test_sysdb_views.c:317:33: error: unused variable ‘el’ [-Werror=unused-variable] struct ldb_message_element *el;
Thanks!
On (28/07/15 10:16), Pavel Reichl wrote:
Hello, please see trivial patch attached which fixes compiler warnings:
../src/tests/cmocka/test_sysdb_views.c: In function ‘test_sysdb_add_overrides_to_object_local’: ../src/tests/cmocka/test_sysdb_views.c:307:33: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] test_ctx->domain->view_name = "LOCAL"; ^ ../src/tests/cmocka/test_sysdb_views.c:288:33: error: unused variable ‘el’ [-Werror=unused-variable] struct ldb_message_element *el; ^ ../src/tests/cmocka/test_sysdb_views.c: In function ‘test_sysdb_add_overrides_to_object_missing_overridedn’: ../src/tests/cmocka/test_sysdb_views.c:340:33: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] test_ctx->domain->view_name = "NON-LOCAL"; ^ ../src/tests/cmocka/test_sysdb_views.c:317:33: error: unused variable ‘el’ [-Werror=unused-variable] struct ldb_message_element *el;
Thanks!
From 017c7fced87e5416f617002f303a37d2f0d0ee41 Mon Sep 17 00:00:00 2001 From: Pavel Reichl preichl@redhat.com Date: Tue, 28 Jul 2015 04:12:48 -0400 Subject: [PATCH] TESTS: fix compiler warnings
src/tests/cmocka/test_sysdb_views.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/tests/cmocka/test_sysdb_views.c b/src/tests/cmocka/test_sysdb_views.c index 83007b76a625edef67109850648b2d71645e22bb..0bacf1f3c5f261d73c006b56503e60afb142b745 100644 --- a/src/tests/cmocka/test_sysdb_views.c +++ b/src/tests/cmocka/test_sysdb_views.c @@ -285,7 +285,6 @@ void test_sysdb_add_overrides_to_object_local(void **state) { int ret; struct ldb_message *orig;
- struct ldb_message_element *el; char *tmp_str; struct sysdb_test_ctx *test_ctx = talloc_get_type_abort(*state, struct sysdb_test_ctx);
@@ -304,7 +303,7 @@ void test_sysdb_add_overrides_to_object_local(void **state) assert_int_equal(ret, EOK);
test_ctx->domain->has_views = true;
- test_ctx->domain->view_name = "LOCAL";
test_ctx->domain->view_name = discard_const("LOCAL");
ret = sysdb_add_overrides_to_object(test_ctx->domain, orig, NULL, NULL); assert_int_equal(ret, EOK);
@@ -314,7 +313,6 @@ void test_sysdb_add_overrides_to_object_missing_overridedn(void **state) { int ret; struct ldb_message *orig;
- struct ldb_message_element *el; char *tmp_str; struct sysdb_test_ctx *test_ctx = talloc_get_type_abort(*state, struct sysdb_test_ctx);
@@ -337,7 +335,7 @@ void test_sysdb_add_overrides_to_object_missing_overridedn(void **state) assert_int_equal(ret, EOK);
test_ctx->domain->has_views = true;
- test_ctx->domain->view_name = "NON-LOCAL";
test_ctx->domain->view_name = discard_const("NON-LOCAL");
ret = sysdb_add_overrides_to_object(test_ctx->domain, orig, NULL, NULL); assert_int_equal(ret, ENOENT);
-- 2.4.3
ACK for unused variables NACK for discard_const It's beeter to change type of view_name from "char *" -> "const char *"
LS
On 07/28/2015 10:28 AM, Lukas Slebodnik wrote:
On (28/07/15 10:16), Pavel Reichl wrote:
Hello, please see trivial patch attached which fixes compiler warnings:
[snip] ACK for unused variables NACK for discard_const It's beeter to change type of view_name from "char *" -> "const char *"
I didn't want to change the code outside of tests without testing, but I assume that if it compiles after such change then it's fine...
Update patch attached.
On (28/07/15 10:46), Pavel Reichl wrote:
On 07/28/2015 10:28 AM, Lukas Slebodnik wrote:
On (28/07/15 10:16), Pavel Reichl wrote:
Hello, please see trivial patch attached which fixes compiler warnings:
[snip] ACK for unused variables NACK for discard_const It's beeter to change type of view_name from "char *" -> "const char *"
I didn't want to change the code outside of tests without testing, but I assume that if it compiles after such change then it's fine...
There was an assumtion that problem is in test. It wasn't right. It's better to avoid explicit casting and discard_const is explicit casting.
From 8ea2ba3a739960c7bba225c2d5cf85f61b358307 Mon Sep 17 00:00:00 2001 From: Pavel Reichl preichl@redhat.com Date: Tue, 28 Jul 2015 04:12:48 -0400 Subject: [PATCH] TESTS: fix compiler warnings
src/confdb/confdb.h | 2 +- src/tests/cmocka/test_sysdb_views.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/confdb/confdb.h b/src/confdb/confdb.h index 36df6aea268cc5c82696f20b1a65963350d5e100..0b0ae0dcf2cd26462a9b0c895d833faf5c85b4e5 100644
ACK
http://sssd-ci.duckdns.org/logs/job/19/67/summary.html
LS
On Tue, Jul 28, 2015 at 12:29:23PM +0200, Lukas Slebodnik wrote:
On (28/07/15 10:46), Pavel Reichl wrote:
On 07/28/2015 10:28 AM, Lukas Slebodnik wrote:
On (28/07/15 10:16), Pavel Reichl wrote:
Hello, please see trivial patch attached which fixes compiler warnings:
[snip] ACK for unused variables NACK for discard_const It's beeter to change type of view_name from "char *" -> "const char *"
I didn't want to change the code outside of tests without testing, but I assume that if it compiles after such change then it's fine...
There was an assumtion that problem is in test. It wasn't right. It's better to avoid explicit casting and discard_const is explicit casting.
From 8ea2ba3a739960c7bba225c2d5cf85f61b358307 Mon Sep 17 00:00:00 2001 From: Pavel Reichl preichl@redhat.com Date: Tue, 28 Jul 2015 04:12:48 -0400 Subject: [PATCH] TESTS: fix compiler warnings
src/confdb/confdb.h | 2 +- src/tests/cmocka/test_sysdb_views.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/confdb/confdb.h b/src/confdb/confdb.h index 36df6aea268cc5c82696f20b1a65963350d5e100..0b0ae0dcf2cd26462a9b0c895d833faf5c85b4e5 100644
ACK
http://sssd-ci.duckdns.org/logs/job/19/67/summary.html
LS
* master: 4f68747b1baca78be496e9a5ebe4b89a9845dc8d
sssd-devel@lists.fedorahosted.org