Browse Source

Fixed warnings generated by clang

master
Artyom Beilis 7 years ago
parent
commit
a46bb45875
9 changed files with 30 additions and 18 deletions
  1. +1
    -1
      cppcms/cache_interface.h
  2. +13
    -0
      cppcms/defs.h
  3. +8
    -8
      cppcms/form.h
  4. +1
    -1
      cppcms/http_content_filter.h
  5. +1
    -1
      cppcms/http_cookie.h
  6. +1
    -1
      private/basic_allocator.h
  7. +2
    -1
      private/buddy_allocator.h
  8. +2
    -2
      private/session_posix_file_storage.h
  9. +1
    -3
      tests/pool_test.cpp

+ 1
- 1
cppcms/cache_interface.h View File

@@ -342,7 +342,7 @@ namespace cppcms {
booster::intrusive_ptr<impl::base_cache> cache_module_; booster::intrusive_ptr<impl::base_cache> cache_module_;


uint32_t page_compression_used_ : 1; uint32_t page_compression_used_ : 1;
uint32_t reserved : 31;
CPPCMS_UNUSED_MEMBER uint32_t reserved : 31;
}; };






+ 13
- 0
cppcms/defs.h View File

@@ -45,4 +45,17 @@
#define CPPCMS_DEPRECATED #define CPPCMS_DEPRECATED
#endif #endif


#if defined __GNUC__ || defined __clang__
#define CPPCMS_UNUSED __attribute__((unused))
#else
#define CPPCMS_UNUSED
#endif

#if defined __clang__
#define CPPCMS_UNUSED_MEMBER __attribute__((unused))
#else
#define CPPCMS_UNUSED_MEMBER
#endif


#endif /// CPPCMS_DEFS_H #endif /// CPPCMS_DEFS_H

+ 8
- 8
cppcms/form.h View File

@@ -153,8 +153,8 @@ namespace cppcms {
uint32_t html_list_type_; uint32_t html_list_type_;
uint32_t widget_part_type_; uint32_t widget_part_type_;
std::ostream *output_; std::ostream *output_;
uint32_t reserved_1;
uint32_t reserved_2;
CPPCMS_UNUSED_MEMBER uint32_t reserved_1;
CPPCMS_UNUSED_MEMBER uint32_t reserved_2;
struct _data; struct _data;
booster::hold_ptr<_data> d; booster::hold_ptr<_data> d;


@@ -703,7 +703,7 @@ namespace cppcms {
uint32_t has_message_ : 1; uint32_t has_message_ : 1;
uint32_t has_error_ : 1; uint32_t has_error_ : 1;
uint32_t has_help_ : 1; uint32_t has_help_ : 1;
uint32_t reserverd_ : 24;
CPPCMS_UNUSED_MEMBER uint32_t reserverd_ : 24;


struct _data; struct _data;
booster::hold_ptr<_data> d; booster::hold_ptr<_data> d;
@@ -1324,7 +1324,7 @@ namespace cppcms {
uint32_t selected : 1; uint32_t selected : 1;
uint32_t need_translation : 1; uint32_t need_translation : 1;
uint32_t original_select : 1; uint32_t original_select : 1;
uint32_t reserved : 29;
CPPCMS_UNUSED_MEMBER uint32_t reserved : 29;
std::string id; std::string id;
std::string str_option; std::string str_option;
locale::message tr_option; locale::message tr_option;
@@ -1411,7 +1411,7 @@ namespace cppcms {
~element(); ~element();


uint32_t need_translation : 1; uint32_t need_translation : 1;
uint32_t reserved : 31;
CPPCMS_UNUSED_MEMBER uint32_t reserved : 31;
std::string id; std::string id;
std::string str_option; std::string str_option;
locale::message tr_option; locale::message tr_option;
@@ -1432,7 +1432,7 @@ namespace cppcms {
int default_selected_; int default_selected_;


uint32_t non_empty_ : 1; uint32_t non_empty_ : 1;
uint32_t reserverd : 32;
CPPCMS_UNUSED_MEMBER uint32_t reserverd : 32;
}; };


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


private: private:
uint32_t vertical_ : 1; uint32_t vertical_ : 1;
uint32_t reserved_ : 31;
CPPCMS_UNUSED_MEMBER uint32_t reserved_ : 31;


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


uint32_t check_charset_ : 1; uint32_t check_charset_ : 1;
uint32_t check_non_empty_ : 1; uint32_t check_non_empty_ : 1;
uint32_t reserved_ : 30;
CPPCMS_UNUSED_MEMBER uint32_t reserved_ : 30;


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




+ 1
- 1
cppcms/http_content_filter.h View File

@@ -17,7 +17,7 @@
namespace cppcms { namespace cppcms {


namespace impl { namespace impl {
class cached_settings;
struct cached_settings;
} }


namespace http { namespace http {


+ 1
- 1
cppcms/http_cookie.h View File

@@ -165,7 +165,7 @@ private:
uint32_t secure_ : 1; uint32_t secure_ : 1;
uint32_t has_age_ : 1; uint32_t has_age_ : 1;
uint32_t has_expiration_: 1; uint32_t has_expiration_: 1;
uint32_t reserved_ : 29;
CPPCMS_UNUSED_MEMBER uint32_t reserved_ : 29;
}; };






+ 1
- 1
private/basic_allocator.h View File

@@ -69,7 +69,7 @@ public :
{ {
return true; return true;
} }
bool operator!=(basic_allocator const& a) const
bool operator!=(basic_allocator const&) const
{ {
return false; return false;
} }


+ 2
- 1
private/buddy_allocator.h View File

@@ -8,6 +8,7 @@
#ifndef CPPCMS_PRIVATE_BUDDY_ALLOCATOR_H #ifndef CPPCMS_PRIVATE_BUDDY_ALLOCATOR_H
#define CPPCMS_PRIVATE_BUDDY_ALLOCATOR_H #define CPPCMS_PRIVATE_BUDDY_ALLOCATOR_H


#include <cppcms/defs.h>
#include <stddef.h> #include <stddef.h>
#include <assert.h> #include <assert.h>
#include <memory.h> #include <memory.h>
@@ -314,7 +315,7 @@ private:
page *free_list_[sizeof(void*)*8]; // 16 always page *free_list_[sizeof(void*)*8]; // 16 always
size_t memory_size_; size_t memory_size_;
int max_bit_size_; // at least sizeof(size_t) int max_bit_size_; // at least sizeof(size_t)
size_t padding_for_alignment_[2];
CPPCMS_UNUSED_MEMBER size_t padding_for_alignment_[2];
}; };
} // impl } // impl
} // cppcms } // cppcms


+ 2
- 2
private/session_posix_file_storage.h View File

@@ -29,7 +29,7 @@ namespace sessions {
virtual void remove(std::string const &sid); virtual void remove(std::string const &sid);
virtual bool is_blocking(); virtual bool is_blocking();
private: private:
struct locked_file;
class locked_file;
struct _data; struct _data;
bool read_timestamp(int fd); bool read_timestamp(int fd);
bool read_from_file(int fd,time_t &timeout,std::string &data); bool read_from_file(int fd,time_t &timeout,std::string &data);
@@ -54,7 +54,7 @@ namespace sessions {
std::vector<pthread_mutex_t> mutexes_; std::vector<pthread_mutex_t> mutexes_;


// friends // friends
friend struct locked_file;
friend class locked_file;
friend class session_file_storage_factory; friend class session_file_storage_factory;
}; };




+ 1
- 3
tests/pool_test.cpp View File

@@ -214,8 +214,7 @@ public:
}; };
sender(cppcms::service &srv,pools *p) : sender(cppcms::service &srv,pools *p) :
cppcms::application(srv), cppcms::application(srv),
pools_(p),
first_time_(true)
pools_(p)
{ {
} }


@@ -265,7 +264,6 @@ public:
} }
private: private:
pools *pools_; pools *pools_;
bool first_time_;
}; };


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


Loading…
Cancel
Save