Skip to content

Commit a46bb45

Browse files
committed
Fixed warnings generated by clang
1 parent d1de6e5 commit a46bb45

9 files changed

Lines changed: 30 additions & 18 deletions

File tree

cppcms/cache_interface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ namespace cppcms {
342342
booster::intrusive_ptr<impl::base_cache> cache_module_;
343343

344344
uint32_t page_compression_used_ : 1;
345-
uint32_t reserved : 31;
345+
CPPCMS_UNUSED_MEMBER uint32_t reserved : 31;
346346
};
347347

348348

cppcms/defs.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,17 @@
4545
#define CPPCMS_DEPRECATED
4646
#endif
4747

48+
#if defined __GNUC__ || defined __clang__
49+
#define CPPCMS_UNUSED __attribute__((unused))
50+
#else
51+
#define CPPCMS_UNUSED
52+
#endif
53+
54+
#if defined __clang__
55+
#define CPPCMS_UNUSED_MEMBER __attribute__((unused))
56+
#else
57+
#define CPPCMS_UNUSED_MEMBER
58+
#endif
59+
60+
4861
#endif /// CPPCMS_DEFS_H

cppcms/form.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ namespace cppcms {
153153
uint32_t html_list_type_;
154154
uint32_t widget_part_type_;
155155
std::ostream *output_;
156-
uint32_t reserved_1;
157-
uint32_t reserved_2;
156+
CPPCMS_UNUSED_MEMBER uint32_t reserved_1;
157+
CPPCMS_UNUSED_MEMBER uint32_t reserved_2;
158158
struct _data;
159159
booster::hold_ptr<_data> d;
160160

@@ -703,7 +703,7 @@ namespace cppcms {
703703
uint32_t has_message_ : 1;
704704
uint32_t has_error_ : 1;
705705
uint32_t has_help_ : 1;
706-
uint32_t reserverd_ : 24;
706+
CPPCMS_UNUSED_MEMBER uint32_t reserverd_ : 24;
707707

708708
struct _data;
709709
booster::hold_ptr<_data> d;
@@ -1324,7 +1324,7 @@ namespace cppcms {
13241324
uint32_t selected : 1;
13251325
uint32_t need_translation : 1;
13261326
uint32_t original_select : 1;
1327-
uint32_t reserved : 29;
1327+
CPPCMS_UNUSED_MEMBER uint32_t reserved : 29;
13281328
std::string id;
13291329
std::string str_option;
13301330
locale::message tr_option;
@@ -1411,7 +1411,7 @@ namespace cppcms {
14111411
~element();
14121412

14131413
uint32_t need_translation : 1;
1414-
uint32_t reserved : 31;
1414+
CPPCMS_UNUSED_MEMBER uint32_t reserved : 31;
14151415
std::string id;
14161416
std::string str_option;
14171417
locale::message tr_option;
@@ -1432,7 +1432,7 @@ namespace cppcms {
14321432
int default_selected_;
14331433

14341434
uint32_t non_empty_ : 1;
1435-
uint32_t reserverd : 32;
1435+
CPPCMS_UNUSED_MEMBER uint32_t reserverd : 32;
14361436
};
14371437

14381438
///
@@ -1474,7 +1474,7 @@ namespace cppcms {
14741474

14751475
private:
14761476
uint32_t vertical_ : 1;
1477-
uint32_t reserved_ : 31;
1477+
CPPCMS_UNUSED_MEMBER uint32_t reserved_ : 31;
14781478

14791479
struct _data;
14801480
booster::hold_ptr<_data> d;
@@ -1573,7 +1573,7 @@ namespace cppcms {
15731573

15741574
uint32_t check_charset_ : 1;
15751575
uint32_t check_non_empty_ : 1;
1576-
uint32_t reserved_ : 30;
1576+
CPPCMS_UNUSED_MEMBER uint32_t reserved_ : 30;
15771577

15781578
booster::shared_ptr<http::file> file_;
15791579

cppcms/http_content_filter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
namespace cppcms {
1818

1919
namespace impl {
20-
class cached_settings;
20+
struct cached_settings;
2121
}
2222

2323
namespace http {

cppcms/http_cookie.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class CPPCMS_API cookie {
165165
uint32_t secure_ : 1;
166166
uint32_t has_age_ : 1;
167167
uint32_t has_expiration_: 1;
168-
uint32_t reserved_ : 29;
168+
CPPCMS_UNUSED_MEMBER uint32_t reserved_ : 29;
169169
};
170170

171171

private/basic_allocator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public :
6969
{
7070
return true;
7171
}
72-
bool operator!=(basic_allocator const& a) const
72+
bool operator!=(basic_allocator const&) const
7373
{
7474
return false;
7575
}

private/buddy_allocator.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#ifndef CPPCMS_PRIVATE_BUDDY_ALLOCATOR_H
99
#define CPPCMS_PRIVATE_BUDDY_ALLOCATOR_H
1010

11+
#include <cppcms/defs.h>
1112
#include <stddef.h>
1213
#include <assert.h>
1314
#include <memory.h>
@@ -314,7 +315,7 @@ class buddy_allocator {
314315
page *free_list_[sizeof(void*)*8]; // 16 always
315316
size_t memory_size_;
316317
int max_bit_size_; // at least sizeof(size_t)
317-
size_t padding_for_alignment_[2];
318+
CPPCMS_UNUSED_MEMBER size_t padding_for_alignment_[2];
318319
};
319320
} // impl
320321
} // cppcms

private/session_posix_file_storage.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace sessions {
2929
virtual void remove(std::string const &sid);
3030
virtual bool is_blocking();
3131
private:
32-
struct locked_file;
32+
class locked_file;
3333
struct _data;
3434
bool read_timestamp(int fd);
3535
bool read_from_file(int fd,time_t &timeout,std::string &data);
@@ -54,7 +54,7 @@ namespace sessions {
5454
std::vector<pthread_mutex_t> mutexes_;
5555

5656
// friends
57-
friend struct locked_file;
57+
friend class locked_file;
5858
friend class session_file_storage_factory;
5959
};
6060

tests/pool_test.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,7 @@ class sender : public cppcms::application {
214214
};
215215
sender(cppcms::service &srv,pools *p) :
216216
cppcms::application(srv),
217-
pools_(p),
218-
first_time_(true)
217+
pools_(p)
219218
{
220219
}
221220

@@ -265,7 +264,6 @@ class sender : public cppcms::application {
265264
}
266265
private:
267266
pools *pools_;
268-
bool first_time_;
269267
};
270268

271269
int main(int argc,char **argv)

0 commit comments

Comments
 (0)