Skip to content

Commit

Permalink
Use compiler flag "-pedantic-errors"
Browse files Browse the repository at this point in the history
コンパイラの拡張機能を禁止し標準に準拠する。

./configureの引数に与えられたCXXFLAGSをJDのフラグより後ろに展開する。
clangは後ろのフラグを優先するため前で展開すると上書きできない場合がある。
  • Loading branch information
ma8ma committed Dec 15, 2018
1 parent 69da80e commit b46e404
Show file tree
Hide file tree
Showing 23 changed files with 41 additions and 44 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Expand Up @@ -70,7 +70,7 @@ dnl ユーザー設定
dnl

dnl 追加コンパイルオプション
CXXFLAGS="$CXXFLAGS -ggdb -Wall"
CXXFLAGS="-ggdb -Wall -pedantic-errors $CXXFLAGS"

dnl ---------------------------------------------------
dnl ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/bbslist/bbslistview.h
Expand Up @@ -34,7 +34,7 @@ namespace BBSLIST

virtual void delete_view_impl();
};
};
}


#endif
4 changes: 2 additions & 2 deletions src/bbslist/bbslistviewbase.h
Expand Up @@ -21,7 +21,7 @@
namespace SKELETON
{
class Admin;
};
}


#define SUBDIR_ETCLIST "外部板"
Expand Down Expand Up @@ -323,7 +323,7 @@ namespace BBSLIST
// ツリーの編集ウィンドウが閉じた
void slot_hide_editlistwin();
};
};
}


#endif
2 changes: 1 addition & 1 deletion src/bbslist/editlistwin.h
Expand Up @@ -46,6 +46,6 @@ namespace BBSLIST
void slot_redo();
void slot_undo_buffer_changed();
};
};
}

#endif
2 changes: 1 addition & 1 deletion src/bbslist/selectdialog.h
Expand Up @@ -48,7 +48,7 @@ namespace BBSLIST
void slot_show_tree();
virtual void timeout();
};
};
}


#endif
2 changes: 1 addition & 1 deletion src/bbslist/selectlistview.h
Expand Up @@ -40,7 +40,7 @@ namespace BBSLIST
virtual Gtk::Menu* get_popupmenu( const std::string& url );
};

};
}


#endif
2 changes: 1 addition & 1 deletion src/board/boardview.h
Expand Up @@ -28,6 +28,6 @@ namespace BOARD
virtual void update_view();
virtual void update_boardname();
};
};
}

#endif
2 changes: 1 addition & 1 deletion src/board/boardviewbase.h
Expand Up @@ -300,7 +300,7 @@ namespace BOARD
void draw_bg_articles();
};

};
}


#endif
2 changes: 1 addition & 1 deletion src/board/boardviewlog.h
Expand Up @@ -48,6 +48,6 @@ namespace BOARD
virtual void save_column_width(){} // 保存しない
};

};
}

#endif
2 changes: 1 addition & 1 deletion src/board/boardviewnext.h
Expand Up @@ -60,6 +60,6 @@ namespace BOARD
virtual void save_column_width(){} // 保存しない
};

};
}

#endif
2 changes: 1 addition & 1 deletion src/board/boardviewsidebar.h
Expand Up @@ -51,6 +51,6 @@ namespace BOARD
virtual void save_column_width(){} // 保存しない
};

};
}

#endif
2 changes: 1 addition & 1 deletion src/dbtree/interface.h
Expand Up @@ -18,7 +18,7 @@
namespace XML
{
class Document;
};
}

namespace DBTREE
{
Expand Down
12 changes: 6 additions & 6 deletions src/dbtree/nodetreebase.cpp
Expand Up @@ -2540,9 +2540,9 @@ const bool NodeTreeBase::check_anchor( const int mode, const char* str_in,
// utf-8で">"
else if( ( unsigned char )( *pos ) == 0xef && ( unsigned char ) ( *( pos + 1 ) ) == 0xbc
&& ( unsigned char ) ( *( pos + 2 ) ) == 0x9e ){
tmp_out[ lng_out++ ] = 0xef;
tmp_out[ lng_out++ ] = 0xbc;
tmp_out[ lng_out++ ] = 0x9e;
tmp_out[ lng_out++ ] = static_cast< char >( 0xef );
tmp_out[ lng_out++ ] = static_cast< char >( 0xbc );
tmp_out[ lng_out++ ] = static_cast< char >( 0x9e );
pos += 3;
}
else if( i == 0 ) return false;
Expand All @@ -2567,9 +2567,9 @@ const bool NodeTreeBase::check_anchor( const int mode, const char* str_in,
else if( ( unsigned char )( *pos ) == 0xe3 && ( unsigned char ) ( *( pos + 1 ) ) == 0x80
&& ( unsigned char ) ( *( pos + 2 ) ) == 0x81 ){

tmp_out[ lng_out++ ] = 0xe3;
tmp_out[ lng_out++ ] = 0x80;
tmp_out[ lng_out++ ] = 0x81;
tmp_out[ lng_out++ ] = static_cast< char >( 0xe3 );
tmp_out[ lng_out++ ] = static_cast< char >( 0x80 );
tmp_out[ lng_out++ ] = static_cast< char >( 0x81 );

str_link[ 0 ] = ',';
++str_link;
Expand Down
2 changes: 1 addition & 1 deletion src/history/historymanager.h
Expand Up @@ -15,7 +15,7 @@ namespace Gtk
{
class Menu;
class MenuItem;
};
}


namespace HISTORY
Expand Down
2 changes: 1 addition & 1 deletion src/image/imageadmin.h
Expand Up @@ -124,7 +124,7 @@ namespace IMAGE

IMAGE::ImageAdmin* get_admin();
void delete_admin();
};
}


#endif
4 changes: 2 additions & 2 deletions src/jdlib/jdiconv.cpp
Expand Up @@ -145,8 +145,8 @@ const char* Iconv::convert( char* str_in, int size_in, int& size_out )
if( ( code0 >= 0x81 && code0 <=0x9F )
|| ( code0 >= 0xe0 && code0 <=0xef ) ){

*m_buf_in_tmp = 0x81;
*(m_buf_in_tmp+1) = 0xa0;
*m_buf_in_tmp = static_cast< char >( 0x81 );
*(m_buf_in_tmp+1) = static_cast< char >( 0xa0 );

#ifdef _DEBUG_ICONV
snprintf( str_tmp, 256, "iconv 0x%x%x -> □ (0x81a0) ", code0, code1 );
Expand Down
4 changes: 2 additions & 2 deletions src/jdlib/loader.h
Expand Up @@ -59,8 +59,8 @@ namespace JDLIB
char* m_buf;

// zlib 用のバッファ
unsigned long m_lng_buf_zlib_in;
unsigned long m_lng_buf_zlib_out;;
unsigned long m_lng_buf_zlib_in;
unsigned long m_lng_buf_zlib_out;
Bytef* m_buf_zlib_in;
Bytef* m_buf_zlib_out;

Expand Down
10 changes: 5 additions & 5 deletions src/jdlib/misctrip.cpp
Expand Up @@ -51,20 +51,20 @@ const std::string create_sha1( const std::string& key )

#ifdef USE_OPENSSL

const unsigned int digest_length = SHA_DIGEST_LENGTH;
constexpr const unsigned int digest_length = SHA_DIGEST_LENGTH;

unsigned char digest[ digest_length ];
std::array< unsigned char, digest_length > digest;

// unsigned char *SHA1( const unsigned char *, size_t, unsigned char * );
SHA1( (const unsigned char *)key.c_str(), key.length(), digest );
SHA1( (const unsigned char *)key.c_str(), key.length(), digest.data() );

#else // defined USE_GNUTLS

const unsigned int digest_length = gcry_md_get_algo_dlen( GCRY_MD_SHA1 );

unsigned char digest[ digest_length ];
std::vector< unsigned char > digest( digest_length );

gcry_md_hash_buffer( GCRY_MD_SHA1, digest, key.c_str(), key.length() );
gcry_md_hash_buffer( GCRY_MD_SHA1, digest.data(), key.c_str(), key.length() );

#endif

Expand Down
2 changes: 1 addition & 1 deletion src/jdlib/misctrip.h
Expand Up @@ -11,6 +11,6 @@ namespace MISC
{
// トリップを取得 (SHA1等の新方式対応)
const std::string get_trip( const std::string& str, const std::string& charset );
};
}

#endif
17 changes: 7 additions & 10 deletions src/jdlib/miscutil.cpp
Expand Up @@ -1060,8 +1060,7 @@ const std::string MISC::url_decode( const std::string& url )

const size_t url_length = url.length();

char decoded[ url_length + 1 ];
memset( decoded, 0, sizeof( decoded ) );
std::vector< char > decoded( url_length + 1, '\0' );

unsigned int a, b;
for( a = 0, b = a; a < url_length; ++a, ++b )
Expand Down Expand Up @@ -1093,7 +1092,7 @@ const std::string MISC::url_decode( const std::string& url )
}
}

return std::string( decoded );
return decoded.data();
}


Expand Down Expand Up @@ -1124,7 +1123,7 @@ const std::string MISC::url_encode( const char* str, const size_t n )
( c != '@' ) &&
( c != '_' )){

snprintf( str_tmp, tmplng , "\%%%02x", c );
snprintf( str_tmp, tmplng , "%%%02x", c );
}
else {
str_tmp[ 0 ] = c;
Expand Down Expand Up @@ -1641,15 +1640,13 @@ const std::string MISC::getenv_limited( const char *name, const size_t size )
{
if( ! name || ! getenv( name ) ) return std::string();

char env[ size + 1 ];
env[ size ] = '\0';

strncpy( env, getenv( name ), size );
std::vector< char > env( size + 1, '\0' );
strncpy( env.data(), getenv( name ), size );

#ifdef _WIN32
return recover_path( Glib::locale_to_utf8( std::string( env ) ) );
return recover_path( Glib::locale_to_utf8( std::string( env.data() ) );
#else
return std::string( env );
return env.data();
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion src/openurldiag.h
Expand Up @@ -25,7 +25,7 @@ namespace CORE

virtual void slot_ok_clicked();
};
};
}


#endif
2 changes: 1 addition & 1 deletion src/session.h
Expand Up @@ -16,7 +16,7 @@
namespace ARTICLE
{
class DrawAreaBase;
};
}

namespace SESSION
{
Expand Down
2 changes: 1 addition & 1 deletion src/skeleton/msgdiag.cpp
Expand Up @@ -217,4 +217,4 @@ MsgOverwriteDiag::MsgOverwriteDiag( Gtk::Window* parent )
add_button( "上書き", OVERWRITE_YES );
add_button( "すべていいえ", OVERWRITE_NO_ALL );
add_button( "すべて上書き", OVERWRITE_YES_ALL );
};
}

0 comments on commit b46e404

Please sign in to comment.