[SSSD] [PATCHES][ding-libs] Enable extra compiler warning flags

Lukas Slebodnik lslebodn at redhat.com
Fri Feb 14 09:19:22 UTC 2014


On (13/02/14 13:40), Dmitri Pal wrote:
>On 02/13/2014 11:07 AM, Lukas Slebodnik wrote:
>>+void print_config_parsing_errors(FILE *file,
>>+                                         struct collection_item *error_set);
>>+
>>+
>>+void print_file_parsing_errors(FILE *file,
>>+                                       struct collection_item *error_list);
>Seems like there is an extra tab or space on the second line.
>I did a visual review. The patches otherwise look fine.
>I have not tried to apply them though.
>
Fixed.
Updated version is attached.

LS
-------------- next part --------------
>From 435f257877e2fda2270ff6b38d30ba19d0282093 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Fri, 10 Jan 2014 21:29:39 +0100
Subject: [PATCH 1/7] INI: Use static modifier for non public functions

Some functions (ini_comment_cb, ini_boundary_cb, is_just_spaces,
is_allowed_spaces, parser_run, read_line) weren't declared in public header
files and they weren't defined with static modifier. This patch fix it.
---
 ini/ini_comment.c   |  6 +++---
 ini/ini_config.c    | 12 ++++++------
 ini/ini_configobj.c | 14 +++++++-------
 ini/ini_parse.c     | 12 ++++++------
 4 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/ini/ini_comment.c b/ini/ini_comment.c
index 53a84f8d0779dab391d66fd6b424f1d0454001e6..fc10b4f302042f89b373bb5a6d588bc438a68f70 100644
--- a/ini/ini_comment.c
+++ b/ini/ini_comment.c
@@ -82,9 +82,9 @@ void ini_comment_destroy(struct ini_comment *ic)
 
 
 /* Cleanup callback */
-void ini_comment_cb(void *elem,
-                    ref_array_del_enum type,
-                    void *data)
+static void ini_comment_cb(void *elem,
+                           ref_array_del_enum type,
+                           void *data)
 {
 
     TRACE_FLOW_ENTRY();
diff --git a/ini/ini_config.c b/ini/ini_config.c
index c0a908bb516f960db98adbbea962b9542250bb38..d46f2f8ffdfb89abad3c36bbf042ad6f247156da 100644
--- a/ini/ini_config.c
+++ b/ini/ini_config.c
@@ -36,12 +36,12 @@
 /* Temporarily move the parsing function here */
 /* THIS FUNCTION WILL BE REMOVED AS SOON AS WE SWITCH TO THE NEW INTERFACE */
 /* Reads a line from the file */
-int read_line(FILE *file,
-              char *buf,
-              int read_size,
-              char **key, char **value,
-              int *length,
-              int *ext_error)
+static int read_line(FILE *file,
+                     char *buf,
+                     int read_size,
+                     char **key, char **value,
+                     int *length,
+                     int *ext_error)
 {
 
     char *res;
diff --git a/ini/ini_configobj.c b/ini/ini_configobj.c
index 603aaf421147fd0b01d057763b7eb544aafc37d6..8ae5ea707693959770bfb7b8f659c24cf5cfa4ce 100644
--- a/ini/ini_configobj.c
+++ b/ini/ini_configobj.c
@@ -173,13 +173,13 @@ int ini_config_create(struct ini_cfgobj **ini_config)
 }
 
 /* Callback to set the boundary */
-int ini_boundary_cb(const char *property,
-                     int property_len,
-                     int type,
-                     void *data,
-                     int length,
-                     void *custom_data,
-                     int *dummy)
+static int ini_boundary_cb(const char *property,
+                           int property_len,
+                           int type,
+                           void *data,
+                           int length,
+                           void *custom_data,
+                           int *dummy)
 {
     int error = EOK;
     struct value_obj *vo = NULL;
diff --git a/ini/ini_parse.c b/ini/ini_parse.c
index 78d030e87cd0ef86588e6fd0db1a9e1294c402c2..7792324aaac1652c0c99bbe1f3ea52e9a68669d8 100644
--- a/ini/ini_parse.c
+++ b/ini/ini_parse.c
@@ -110,7 +110,7 @@ static int save_error(struct collection_item *el,
                       const char *err_txt);
 
 
-int is_just_spaces(const char *str, uint32_t len)
+static int is_just_spaces(const char *str, uint32_t len)
 {
     uint32_t i;
 
@@ -132,10 +132,10 @@ int is_just_spaces(const char *str, uint32_t len)
  * the line is OK too.
  * Any other character will cause an error.
  */
-int is_allowed_spaces(const char *str,
-                      uint32_t len,
-                      uint32_t parse_flags,
-                      int *error)
+static int is_allowed_spaces(const char *str,
+                             uint32_t len,
+                             uint32_t parse_flags,
+                             int *error)
 {
     uint32_t i;
     int line_ok = 1;
@@ -1602,7 +1602,7 @@ static int parser_error(struct parser_obj *po)
 
 
 /* Run parser */
-int parser_run(struct parser_obj *po)
+static int parser_run(struct parser_obj *po)
 {
     int error = EOK;
     struct collection_item *item = NULL;
-- 
1.8.5.3

-------------- next part --------------
>From 9132ee866ec90e54008448d004d966ccb71d3df1 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Sat, 11 Jan 2014 15:08:10 +0100
Subject: [PATCH 2/7] Use static modifier for unit test functions

This change fixes compiler warnings:
    warning: no previous prototype for 'function_abc' [-Wmissing-prototypes]
---
 basicobjects/simplebuffer_ut.c   |  2 +-
 collection/collection_queue_ut.c |  4 ++--
 collection/collection_stack_ut.c |  2 +-
 collection/collection_ut.c       | 36 ++++++++++++++--------------
 dhash/examples/dhash_example.c   | 10 +++++---
 dhash/examples/dhash_test.c      | 13 +++++-----
 ini/ini_comment_ut.c             |  8 +++----
 ini/ini_config_ut.c              | 16 ++++++-------
 ini/ini_parse_ut.c               | 52 ++++++++++++++++++++--------------------
 ini/ini_valueobj_ut.c            | 14 +++++------
 path_utils/path_utils_ut.c       | 20 +++++++++-------
 refarray/ref_array_ut.c          | 20 ++++++++--------
 12 files changed, 102 insertions(+), 95 deletions(-)

diff --git a/basicobjects/simplebuffer_ut.c b/basicobjects/simplebuffer_ut.c
index ba9d172856262fe9ca34abf0dd702c1d305544c9..7b90d261979e49298996d5608635c933ed501f88 100644
--- a/basicobjects/simplebuffer_ut.c
+++ b/basicobjects/simplebuffer_ut.c
@@ -37,7 +37,7 @@ int verbose = 0;
     } while(0)
 
 
-int simple_test(void)
+static int simple_test(void)
 {
     int error = EOK;
     struct simplebuffer *data = NULL;
diff --git a/collection/collection_queue_ut.c b/collection/collection_queue_ut.c
index c4f7a68b2b927fff5d89c26cbf896f20413824b2..4ba5cd0b2cfd07d57dedca584a4fdbbe44ebf9c4 100644
--- a/collection/collection_queue_ut.c
+++ b/collection/collection_queue_ut.c
@@ -37,7 +37,7 @@ int verbose = 0;
     } while(0)
 
 
-int queue_test(void)
+static int queue_test(void)
 {
     struct collection_item *queue = NULL;
     char binary_dump[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
@@ -96,7 +96,7 @@ int queue_test(void)
 }
 
 
-int empty_test(void)
+static int empty_test(void)
 {
     struct collection_item *queue = NULL;
     struct collection_item *item = NULL;
diff --git a/collection/collection_stack_ut.c b/collection/collection_stack_ut.c
index 9c25308fa878430f46fc7c84cf3500e3eb1b6086..57b4db886c8b748cb0baa0ec17cfab3f49bef450 100644
--- a/collection/collection_stack_ut.c
+++ b/collection/collection_stack_ut.c
@@ -38,7 +38,7 @@ int verbose = 0;
 
 
 
-int stack_test(void)
+static int stack_test(void)
 {
     struct collection_item *stack = NULL;
     char binary_dump[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
diff --git a/collection/collection_ut.c b/collection/collection_ut.c
index 26928794fc737eb2d622275e1bcaef93323b52cd..965daf408bf91767ea45f070dc33eba6b08e560d 100644
--- a/collection/collection_ut.c
+++ b/collection/collection_ut.c
@@ -39,7 +39,7 @@ int verbose = 0;
 
 
 
-int ref_collection_test(void)
+static int ref_collection_test(void)
 {
     struct collection_item *peer = NULL;
     struct collection_item *socket = NULL;
@@ -131,7 +131,7 @@ int ref_collection_test(void)
 }
 
 
-int single_collection_test(void)
+static int single_collection_test(void)
 {
     struct collection_item *handle = NULL;
     int error = EOK;
@@ -192,7 +192,7 @@ int single_collection_test(void)
     return error;
 }
 
-int add_collection_test(void)
+static int add_collection_test(void)
 {
     struct collection_item *peer = NULL;
     struct collection_item *socket = NULL;
@@ -250,9 +250,9 @@ int add_collection_test(void)
     return error;
 }
 
-int copy_cb(struct collection_item *item,
-            void *ext_data,
-            int *skip)
+static int copy_cb(struct collection_item *item,
+                   void *ext_data,
+                   int *skip)
 {
     COLOUT(printf("INSIDE Copy Callback\n"));
     COLOUT(col_debug_item(item));
@@ -262,7 +262,7 @@ int copy_cb(struct collection_item *item,
 }
 
 
-int mixed_collection_test(void)
+static int mixed_collection_test(void)
 {
     struct collection_item *peer;
     struct collection_item *socket1;
@@ -643,7 +643,7 @@ int mixed_collection_test(void)
 }
 
 
-int iterator_test(void)
+static int iterator_test(void)
 {
     struct collection_item *peer = NULL;
     struct collection_item *initial = NULL;
@@ -1341,7 +1341,7 @@ int iterator_test(void)
 }
 
 
-int insert_extract_test(void)
+static int insert_extract_test(void)
 {
     struct collection_item *col;
     struct collection_item *col2;
@@ -1531,12 +1531,12 @@ int insert_extract_test(void)
 }
 
 /* Cleanup collback */
-void cb(const char *property,
-        int property_len,
-        int type,
-        void *data,
-        int length,
-        void *ext_data)
+static void cb(const char *property,
+               int property_len,
+               int type,
+               void *data,
+               int length,
+               void *ext_data)
 {
     COLOUT(printf("%s\n", *((const char **)ext_data)));
     COLOUT(printf("Property: %s\n", property));
@@ -1545,7 +1545,7 @@ void cb(const char *property,
     COLOUT(printf("Data len: %d\n", length));
 }
 
-int delete_test(void)
+static int delete_test(void)
 {
 
     struct collection_item *col;
@@ -1605,7 +1605,7 @@ int delete_test(void)
 }
 
 /* Search test */
-int search_test(void)
+static int search_test(void)
 {
     struct collection_item *level1 = NULL;
     struct collection_item *level2 = NULL;
@@ -1782,7 +1782,7 @@ int search_test(void)
 }
 
 /* Sort test */
-int sort_test(void)
+static int sort_test(void)
 {
     struct collection_item *level1 = NULL;
     struct collection_item *level2a = NULL;
diff --git a/dhash/examples/dhash_example.c b/dhash/examples/dhash_example.c
index c7eac3daae3780c2a19aa6f377e2342aad7be51e..d2095bd05a7e358ad644805b4221d130234facd3 100644
--- a/dhash/examples/dhash_example.c
+++ b/dhash/examples/dhash_example.c
@@ -29,12 +29,15 @@ struct my_data_t {
     char bar[128];
 };
 
-void delete_callback(hash_entry_t *entry, hash_destroy_enum type, void *pvt)
+static void delete_callback(hash_entry_t *entry,
+                            hash_destroy_enum type,
+                            void *pvt)
 {
     if (entry->value.type == HASH_VALUE_PTR) free(entry->value.ptr);
 }
 
-bool visit_callback(hash_entry_t *entry, void *user_data)
+static bool visit_callback(hash_entry_t *entry,
+                           void *user_data)
 {
     unsigned long *count = (unsigned long *)user_data;
     struct my_data_t *my_data = (struct my_data_t *) entry->value.ptr;
@@ -45,13 +48,14 @@ bool visit_callback(hash_entry_t *entry, void *user_data)
     return true;
 }
 
-struct my_data_t *new_data(int foo, const char *bar)
+static struct my_data_t *new_data(int foo, const char *bar)
 {
     struct my_data_t *my_data = malloc(sizeof(struct my_data_t));
     my_data->foo = foo;
     strncpy(my_data->bar, bar, sizeof(my_data->bar));
     return my_data;
 }
+
 int main(int argc, char **argv)
 {
     static hash_table_t *table = NULL;
diff --git a/dhash/examples/dhash_test.c b/dhash/examples/dhash_test.c
index f57bc5270facd6f4e8dbef0db8ceda362da3c392..303e9f815ca8fb88446e2157251044439a404357 100644
--- a/dhash/examples/dhash_test.c
+++ b/dhash/examples/dhash_test.c
@@ -34,7 +34,7 @@ hash_entry_t *iter_result_2 = NULL;
 unsigned long max_test = DEFAULT_MAX_TEST;
 int verbose = 0;
 
-const char *error_string(int error)
+static const char *error_string(int error)
 {
     const char *str;
 
@@ -53,7 +53,7 @@ const char *error_string(int error)
     return str;
 }
 
-char *key_string(hash_key_t *key)
+static char *key_string(hash_key_t *key)
 {
     static char buf[BUF_SIZE];
 
@@ -71,7 +71,7 @@ char *key_string(hash_key_t *key)
     return buf;
 }
 
-char *value_string(hash_value_t *value)
+static char *value_string(hash_value_t *value)
 {
     static char buf[BUF_SIZE];
 
@@ -108,7 +108,7 @@ char *value_string(hash_value_t *value)
     return buf;
 }
 
-char *entry_string(hash_entry_t *entry)
+static char *entry_string(hash_entry_t *entry)
 {
     static char buf[BUF_SIZE];
 
@@ -118,7 +118,7 @@ char *entry_string(hash_entry_t *entry)
 
 }
 
-bool callback(hash_entry_t *item, void *user_data)
+static bool callback(hash_entry_t *item, void *user_data)
 {
     unsigned long *callback_count = (unsigned long *)user_data;
 
@@ -130,7 +130,8 @@ bool callback(hash_entry_t *item, void *user_data)
     return true;
 }
 
-void delete_callback(hash_entry_t *item, hash_destroy_enum type, void *pvt)
+static void delete_callback(hash_entry_t *item, hash_destroy_enum type,
+                            void *pvt)
 {
     if (item->value.type == HASH_VALUE_PTR) free(item->value.ptr);
 }
diff --git a/ini/ini_comment_ut.c b/ini/ini_comment_ut.c
index eb463600c3d6d30204b3eea83a0a0d28fa80d83a..d45e5d70919870fb37d7246316efc225e3ad6aca 100644
--- a/ini/ini_comment_ut.c
+++ b/ini/ini_comment_ut.c
@@ -36,7 +36,7 @@ int verbose = 0;
 
 typedef int (*test_fn)(void);
 
-int file_test(void)
+static int file_test(void)
 {
     int error = EOK;
     struct ini_comment *ic = NULL;
@@ -60,7 +60,7 @@ int file_test(void)
 }
 
 
-int alter_test(void)
+static int alter_test(void)
 {
     int error = EOK;
     struct ini_comment *ic = NULL;
@@ -158,7 +158,7 @@ int alter_test(void)
     return error;
 }
 
-int copy_test(void)
+static int copy_test(void)
 {
     int error = EOK;
     struct ini_comment *ic = NULL;
@@ -233,7 +233,7 @@ int copy_test(void)
     return error;
 }
 
-int add_test(void)
+static int add_test(void)
 {
     int error = EOK;
     struct ini_comment *ic = NULL;
diff --git a/ini/ini_config_ut.c b/ini/ini_config_ut.c
index fff3c4e920e703cef19a52407984f1c288d737f4..cd0354b9782f90d9c8f09b4ad6c7895c04d9c3dd 100644
--- a/ini/ini_config_ut.c
+++ b/ini/ini_config_ut.c
@@ -42,7 +42,7 @@ int verbose = 0;
     } while(0)
 
 
-int basic_test(void)
+static int basic_test(void)
 {
     int error;
     struct collection_item *ini_config = NULL;
@@ -84,7 +84,7 @@ int basic_test(void)
     return 0;
 }
 
-int single_file(void)
+static int single_file(void)
 {
     int error;
     struct collection_item *ini_config = NULL;
@@ -189,7 +189,7 @@ int single_file(void)
     return 0;
 }
 
-int single_fd(void)
+static int single_fd(void)
 {
     int error;
     struct collection_item *ini_config = NULL;
@@ -306,7 +306,7 @@ int single_fd(void)
     return 0;
 }
 
-int negative_test(void)
+static int negative_test(void)
 {
     int error;
     unsigned int count;
@@ -374,7 +374,7 @@ int negative_test(void)
 
 }
 
-int real_test(const char *file)
+static int real_test(const char *file)
 {
     int error;
     struct collection_item *ini_config = NULL;
@@ -456,7 +456,7 @@ int real_test(const char *file)
     return 0;
 }
 
-int get_test(void)
+static int get_test(void)
 {
 
     int error;
@@ -1298,7 +1298,7 @@ int get_test(void)
  * and one needs to parse the configuration file
  * for the first time and load configuration
  */
-int startup_test(void)
+static int startup_test(void)
 {
     int error;
     struct collection_item *ini_config = NULL;
@@ -1417,7 +1417,7 @@ int startup_test(void)
     return 0;
 }
 
-int reload_test(void)
+static int reload_test(void)
 {
 
     int error;
diff --git a/ini/ini_parse_ut.c b/ini/ini_parse_ut.c
index 33019b2b934779b71b11fc3dc7dbc2bbbedc5539..1fa26249073db9e1dc1e39340ba0afa73b559540 100644
--- a/ini/ini_parse_ut.c
+++ b/ini/ini_parse_ut.c
@@ -48,9 +48,9 @@ char *confdir = NULL;
 
 typedef int (*test_fn)(void);
 
-int test_one_file(const char *in_filename,
-                  const char *out_filename,
-                  int edge)
+static int test_one_file(const char *in_filename,
+                         const char *out_filename,
+                         int edge)
 {
     int error = EOK;
     struct ini_cfgfile *file_ctx = NULL;
@@ -170,7 +170,7 @@ int test_one_file(const char *in_filename,
 
 
 /* Run tests for multiple files */
-int read_save_test(void)
+static int read_save_test(void)
 {
     int error = EOK;
     int i = 0;
@@ -212,7 +212,7 @@ int read_save_test(void)
 }
 
 /* Run tests for multiple files */
-int read_again_test(void)
+static int read_again_test(void)
 {
     int error = EOK;
     int i = 0;
@@ -264,7 +264,7 @@ int read_again_test(void)
     return error;
 }
 
-int create_expect(const char *checkname)
+static int create_expect(const char *checkname)
 {
     FILE *ff;
     int error = EOK;
@@ -333,7 +333,7 @@ int create_expect(const char *checkname)
 }
 
 /* Check merge modes */
-int merge_values_test(void)
+static int merge_values_test(void)
 {
     int error = EOK;
     int i;
@@ -493,7 +493,7 @@ int merge_values_test(void)
 }
 
 /* Check merge modes */
-int merge_section_test(void)
+static int merge_section_test(void)
 {
     int error = EOK;
     int i, j;
@@ -697,9 +697,9 @@ int merge_section_test(void)
     return error;
 }
 
-int read_one_file(char *name,
-                  struct ini_cfgobj *ini_config,
-                  uint32_t collision_flags)
+static int read_one_file(char *name,
+                         struct ini_cfgobj *ini_config,
+                         uint32_t collision_flags)
 {
     int error = EOK;
     struct ini_cfgfile *file_ctx = NULL;
@@ -746,7 +746,7 @@ int read_one_file(char *name,
 }
 
 /* Check merge modes */
-int merge_file_test(void)
+static int merge_file_test(void)
 {
     int error = EOK;
     int i, j;
@@ -1067,7 +1067,7 @@ int merge_file_test(void)
     return EOK;
 }
 
-int startup_test(void)
+static int startup_test(void)
 {
     int error = EOK;
     struct ini_cfgfile *file_ctx = NULL;
@@ -1235,7 +1235,7 @@ int startup_test(void)
     return 0;
 }
 
-int reload_test(void)
+static int reload_test(void)
 {
     int error = EOK;
     struct ini_cfgfile *file_ctx = NULL;
@@ -1428,13 +1428,13 @@ int reload_test(void)
     return 0;
 }
 
-int test_one_array(struct ini_cfgobj *ini_config,
-                   const char *section,
-                   const char *value,
-                   int raw,
-                   int expect,
-                   const char *sep,
-                   const char *message)
+static int test_one_array(struct ini_cfgobj *ini_config,
+                          const char *section,
+                          const char *value,
+                          int raw,
+                          int expect,
+                          const char *sep,
+                          const char *message)
 {
     struct value_obj *vo = NULL;
     int error = 0;
@@ -1496,7 +1496,7 @@ int test_one_array(struct ini_cfgobj *ini_config,
     return EOK;
 }
 
-int get_test(void)
+static int get_test(void)
 {
 
     int error;
@@ -2782,7 +2782,7 @@ int get_test(void)
     return EOK;
 }
 
-int space_test(void)
+static int space_test(void)
 {
 
     int error;
@@ -2866,7 +2866,7 @@ int space_test(void)
 }
 
 
-int trim_test(void)
+static int trim_test(void)
 {
     int error;
     struct ini_cfgfile *file_ctx = NULL;
@@ -2965,7 +2965,7 @@ int trim_test(void)
     return EOK;
 }
 
-int comment_test(void)
+static int comment_test(void)
 {
     int error;
     struct ini_cfgfile *file_ctx = NULL;
@@ -3030,7 +3030,7 @@ int comment_test(void)
     return EOK;
 }
 
-void create_boms(void)
+static void create_boms(void)
 {
     FILE *f;
 
diff --git a/ini/ini_valueobj_ut.c b/ini/ini_valueobj_ut.c
index 9ab960ffcf2914b73e96598d1a2d760e9fa2d617..62ee9846a6be6cf4ea83b974576005170cb7c2fb 100644
--- a/ini/ini_valueobj_ut.c
+++ b/ini/ini_valueobj_ut.c
@@ -76,7 +76,7 @@ static int create_comment(int i, struct ini_comment **ic)
 
 /* Save value to the file */
 /* NOTE: might be moved into the API in future */
-int save_value(FILE *ff, const char *key, struct value_obj *vo)
+static int save_value(FILE *ff, const char *key, struct value_obj *vo)
 {
 
     int error = EOK;
@@ -125,7 +125,7 @@ int save_value(FILE *ff, const char *key, struct value_obj *vo)
 }
 
 /* Test to create value object using arrays */
-int other_create_test(FILE *ff, struct value_obj **vo)
+static int other_create_test(FILE *ff, struct value_obj **vo)
 {
     int error = EOK;
     struct value_obj *new_vo = NULL;
@@ -338,7 +338,7 @@ int other_create_test(FILE *ff, struct value_obj **vo)
 }
 
 /* Modify the value object */
-int modify_test(FILE *ff, struct value_obj *vo)
+static int modify_test(FILE *ff, struct value_obj *vo)
 {
     int error = EOK;
     const char *strval = "Domain100, Domain200, Domain300";
@@ -377,7 +377,7 @@ int modify_test(FILE *ff, struct value_obj *vo)
 }
 
 
-int vo_basic_test(void)
+static int vo_basic_test(void)
 {
     int error = EOK;
     const char *strvalue = "Test multi_word_value_that_will_"
@@ -480,7 +480,7 @@ int vo_basic_test(void)
     return EOK;
 }
 
-int vo_copy_test(void)
+static int vo_copy_test(void)
 {
     int error = EOK;
     const char *strvalue = "Test multi word value that "
@@ -623,13 +623,13 @@ int vo_copy_test(void)
     return EOK;
 }
 
-int vo_show_test(void)
+static int vo_show_test(void)
 {
     VOOUT(system("cat test.ini"));
     return EOK;
 }
 
-int vo_mc_test(void)
+static int vo_mc_test(void)
 {
     int error = EOK;
     struct value_obj *vo1 = NULL;
diff --git a/path_utils/path_utils_ut.c b/path_utils/path_utils_ut.c
index cdbdf33e171333fa10e5c462e6d955fe465b5bd6..27c99b617d2b83d6bba42d677aaa9bdbfed93a14 100644
--- a/path_utils/path_utils_ut.c
+++ b/path_utils/path_utils_ut.c
@@ -580,7 +580,7 @@ START_TEST(test_find_existing_directory_ancestor_neg)
 END_TEST
 
 /**** directory_list ****/
-void setup_directory_list(void)
+static void setup_directory_list(void)
 {
     char *s = NULL;
     int ret;
@@ -602,7 +602,7 @@ void setup_directory_list(void)
     fail_unless(ret != -1, "mkdir %s failed [%d][%s]", dlist_subsubdir, errno, strerror(errno));
 }
 
-void teardown_directory_list(void)
+static void teardown_directory_list(void)
 {
     int ret;
 
@@ -628,9 +628,11 @@ void teardown_directory_list(void)
     }
 }
 
-bool dirlist_cb_nonrecursive(const char *directory, const char *base_name,
-                             const char *path, struct stat *info,
-                             void *user_data)
+static bool dirlist_cb_nonrecursive(const char *directory,
+                                    const char *base_name,
+                                    const char *path,
+                                    struct stat *info,
+                                    void *user_data)
 {
     int *data = (int *) user_data;
 
@@ -640,9 +642,9 @@ bool dirlist_cb_nonrecursive(const char *directory, const char *base_name,
     return true;
 }
 
-bool dirlist_cb_recursive(const char *directory, const char *base_name,
-                          const char *path, struct stat *info,
-                          void *user_data)
+static bool dirlist_cb_recursive(const char *directory, const char *base_name,
+                                 const char *path, struct stat *info,
+                                 void *user_data)
 {
     bool *seen_child = (bool *) user_data;
     static bool seen_parent = false;
@@ -698,7 +700,7 @@ START_TEST(test_is_ancestor_path)
 END_TEST
 
 
-Suite *path_utils_suite(void)
+static Suite *path_utils_suite(void)
 {
     Suite *s = suite_create("path_utils");
 
diff --git a/refarray/ref_array_ut.c b/refarray/ref_array_ut.c
index 343b7faa8862797306d836759ebc2b54bd61de2e..5df089fbf878150dcb0812af800417f6abc114a2 100644
--- a/refarray/ref_array_ut.c
+++ b/refarray/ref_array_ut.c
@@ -40,7 +40,7 @@ extern void ref_array_debug(struct ref_array *ra, int num);
 typedef int (*test_fn)(void);
 
 /* Basic test */
-int ref_array_basic_test(void)
+static int ref_array_basic_test(void)
 {
     const char *line1 = "line1";
     const char *line2 = "line2";
@@ -217,16 +217,16 @@ int ref_array_basic_test(void)
     return EOK;
 }
 
-void array_cleanup(void *elem,
-                   ref_array_del_enum type,
-                   void *data)
+static void array_cleanup(void *elem,
+                          ref_array_del_enum type,
+                          void *data)
 {
     RAOUT(printf("%s%s\n", (char *)data, *((char **)elem)));
     free(*((char **)elem));
 }
 
 /* Free test */
-int ref_array_free_test(void)
+static int ref_array_free_test(void)
 {
     const char *line1 = "line1";
     const char *line2 = "line2";
@@ -308,7 +308,7 @@ int ref_array_free_test(void)
     return EOK;
 }
 
-int ref_array_adv_test(void)
+static int ref_array_adv_test(void)
 {
     int error = EOK;
     const char *lines[] = { "line0",
@@ -559,8 +559,8 @@ int ref_array_adv_test(void)
     return EOK;
 }
 
-int copy_cb(void *elem,
-            void *new_elem)
+static int copy_cb(void *elem,
+                   void *new_elem)
 {
     char *ne = NULL;
 
@@ -573,7 +573,7 @@ int copy_cb(void *elem,
     return EOK;
 }
 
-int ref_array_copy_test(void)
+static int ref_array_copy_test(void)
 {
     const char *line1 = "line1";
     const char *line2 = "line2";
@@ -686,7 +686,7 @@ int ref_array_copy_test(void)
 
 }
 
-int ref_array_copy_num_test(void)
+static int ref_array_copy_num_test(void)
 {
     uint32_t i,j,k;
     struct ref_array *ra;
-- 
1.8.5.3

-------------- next part --------------
>From 55cf342b1e655d7270897e21543ee172e036b828 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Sat, 11 Jan 2014 15:18:40 +0100
Subject: [PATCH 3/7] INI: Fix warning missing-prototypes for some functions.

Experimental functions are not declared in public header files, but we want to
suppress warnings missing-prototypes.

We also want to suppress warnings missing-prototypes for function from old
interface (ini_config.h), which are in the module ini_print.c;
because we don't want to include header file with old interface(ini_config.h)
and new interface(ini_configobj.h) into the same implementation module.
---
 ini/ini_print.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/ini/ini_print.c b/ini/ini_print.c
index c27bfa2d3b884734182d8c649c0c8884e31df844..f39f34ee73f46800b0f43eb0c5281e98019cdcc3 100644
--- a/ini/ini_print.c
+++ b/ini/ini_print.c
@@ -32,6 +32,18 @@
 #include "ini_config_priv.h"
 #include "ini_configobj.h"
 
+/* Following declarations are from header file ini_config.h. This file was not
+ * included, because we don't want on include header file
+ * with old interface(ini_config.h) and new interface(ini_configobj.h)
+ * into the one file.
+ */
+void print_config_parsing_errors(FILE *file,
+                                 struct collection_item *error_set);
+
+
+void print_file_parsing_errors(FILE *file,
+                               struct collection_item *error_list);
+
 
 /*============================================================*/
 /* The following classes moved here from the public header
@@ -338,11 +350,13 @@ void print_file_parsing_errors(FILE *file,
 }
 
 
+void print_grammar_errors(FILE *file,
+                          struct collection_item *error_list);
 /* Print errors and warnings that were detected while processing grammar.
  *
  * The following doxygen description is moved here.
  * When the function gets exposed move it into
- * the header file.
+ * the header file and remove prototype from this file.
  */
 /**
  * @brief Print errors and warnings that were detected while
@@ -367,11 +381,13 @@ void print_grammar_errors(FILE *file,
                      INI_FAMILY_GRAMMAR);
 }
 
+void print_validation_errors(FILE *file,
+                             struct collection_item *error_list);
 /* Print errors and warnings that were detected while validating INI file.
  *
  * The following doxygen description is moved here.
  * When the function gets exposed move it into
- * the header file.
+ * the header file and remove prototype from this file.
  */
 /**
  * @brief Print errors and warnings that were detected while
-- 
1.8.5.3

-------------- next part --------------
>From ab49873fa52b5eb13d7614bdec91366a2a474cdf Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Thu, 13 Feb 2014 16:50:45 +0100
Subject: [PATCH 4/7] INI: Include missing header file with declarations

Function ini_config_serialize was declared in the header file ini_configobj.h,
but this header file was not included in implementation module ini_serialize.c
---
 ini/ini_serialize.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ini/ini_serialize.c b/ini/ini_serialize.c
index dcda5acc32973c261391bdb59935c6c5aa35efc6..d0399029a526802fd04e43c5777e562e01360708 100644
--- a/ini/ini_serialize.c
+++ b/ini/ini_serialize.c
@@ -28,6 +28,7 @@
 #include "collection.h"
 #include "ini_valueobj.h"
 #include "ini_defines.h"
+#include "ini_configobj.h"
 #include "ini_config_priv.h"
 #include "trace.h"
 
-- 
1.8.5.3

-------------- next part --------------
>From e67da9499970cf66694ec48133b5752b3ba08cc4 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Sat, 11 Jan 2014 15:42:01 +0100
Subject: [PATCH 5/7] REFARRAY: Move declaration of ref_array_debug to public
 header file

---
 ini/ini_valueobj.c      |  2 --
 ini/ini_valueobj_ut.c   |  3 ---
 refarray/ref_array.h    | 16 ++++++++++++++++
 refarray/ref_array_ut.c |  2 --
 4 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/ini/ini_valueobj.c b/ini/ini_valueobj.c
index 20e61cd3f291aea076a16f35bec1bcd143656356..02d064323f84a18f274c1f95f0f975c51fda63de 100644
--- a/ini/ini_valueobj.c
+++ b/ini/ini_valueobj.c
@@ -1063,8 +1063,6 @@ int value_serialize(struct value_obj *vo,
 
 #ifdef HAVE_TRACE
 
-extern void ref_array_debug(struct ref_array *ra, int num);
-
         ref_array_debug(vo->raw_lines, 0);
         ref_array_debug(vo->raw_lengths, 1);
 #endif
diff --git a/ini/ini_valueobj_ut.c b/ini/ini_valueobj_ut.c
index 62ee9846a6be6cf4ea83b974576005170cb7c2fb..0a61069d50cecd430551539ddd4a9e07981fe2c8 100644
--- a/ini/ini_valueobj_ut.c
+++ b/ini/ini_valueobj_ut.c
@@ -42,9 +42,6 @@ int verbose = 0;
 
 typedef int (*test_fn)(void);
 
-
-extern void ref_array_debug(struct ref_array *ra);
-
 static int create_comment(int i, struct ini_comment **ic)
 {
     int error = EOK;
diff --git a/refarray/ref_array.h b/refarray/ref_array.h
index d271d38b48b458ebf469f1387ef8e0679c8fa757..48e43075781f91107ef3f1489609b0166410fadd 100644
--- a/refarray/ref_array.h
+++ b/refarray/ref_array.h
@@ -363,6 +363,22 @@ int ref_array_copy(struct ref_array *ra,
                    struct ref_array **copy_ra);
 
 
+
+/**
+ * @brief Print array for debugging purposes.
+ *
+ * Prints array internals.
+ *
+ * @param[in]  ra        Existing array object.
+ * @param[in]  num       If num is 0 elements will be printed as strings.
+ *                       If num is greater than 0 elements will be printed as
+ *                       decimal numbers. Otherwise element will not be
+ *                       interpreted in concrete way.
+ *
+ * No return value.
+ */
+void ref_array_debug(struct ref_array *ra, int num);
+
 /**
  * @}
  */
diff --git a/refarray/ref_array_ut.c b/refarray/ref_array_ut.c
index 5df089fbf878150dcb0812af800417f6abc114a2..5ce81a72c3c6d4e8c92d1b1ab72716a83b65cc34 100644
--- a/refarray/ref_array_ut.c
+++ b/refarray/ref_array_ut.c
@@ -35,8 +35,6 @@ int verbose = 0;
         if (verbose) foo; \
     } while(0)
 
-extern void ref_array_debug(struct ref_array *ra, int num);
-
 typedef int (*test_fn)(void);
 
 /* Basic test */
-- 
1.8.5.3

-------------- next part --------------
>From bfd3bd8decd1a7718e5245db9cd12db6dbc3f25b Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Tue, 4 Feb 2014 13:37:22 +0100
Subject: [PATCH 6/7] DHASH: Use ifdef for testing DEBUG macro

"#ifdef DEBUG" was used 5 times and "#if DEBUG" was used 2 times.
This patch unifies usage.
---
 dhash/dhash.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dhash/dhash.c b/dhash/dhash.c
index a9b4f647c638484a981adb8efd4da9020785d7c6..45ee0cfe6e883fc7297198798447fb05144750ed 100644
--- a/dhash/dhash.c
+++ b/dhash/dhash.c
@@ -155,7 +155,7 @@ static hash_entry_t *hash_iter_next(struct hash_iter_context_t *iter);
 /*************************  Internal Global Variables  ***********************/
 /*****************************************************************************/
 
-#if DEBUG
+#ifdef DEBUG
 int debug_level = 1;
 #endif
 
@@ -620,7 +620,7 @@ int hash_create_ex(unsigned long count, hash_table_t **tbl,
     table->min_load_factor = min_load_factor == 0 ? HASH_DEFAULT_MIN_LOAD_FACTOR : min_load_factor;
     table->max_load_factor = max_load_factor == 0 ? HASH_DEFAULT_MAX_LOAD_FACTOR : max_load_factor;
 
-#if DEBUG
+#ifdef DEBUG
     if (debug_level >= 1) {
         fprintf(stderr, "hash_create_ex: count=%lu available buckets=%lu bucket_count=%lu maxp=%lu\n",
                 count, table->directory_size*table->segment_size, table->bucket_count, table->maxp);
-- 
1.8.5.3

-------------- next part --------------
>From 8ae8062255a7b56b4eeda66078c1183e6cfe11fe Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Sat, 11 Jan 2014 15:48:31 +0100
Subject: [PATCH 7/7] Enable extra compiler warning flags

---
 Makefile.am | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index e931e2a6dee44c5413cad6c87d6ef0339c57ead1..99e8565df633b50ab49c1ed0434ffb1c47a491c0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -17,7 +17,8 @@ AM_CFLAGS =
 if HAVE_GCC
     AM_CFLAGS += \
         -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual \
-        -Wcast-align -Wwrite-strings
+        -Wcast-align -Wwrite-strings -Wextra -Wno-unused-parameter \
+        -Wno-sign-compare -Wformat-security -Wmissing-prototypes -Wundef
 endif
 
 AM_CPPFLAGS = \
-- 
1.8.5.3



More information about the sssd-devel mailing list