Voilà, j'ai une classe très simple :
Object.hh
Object.cc :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 #ifndef _OBJECT_HH_ #define _OBJECT_HH_ #include <string> namespace Core { class Object { public: Object( std::string & ); std::string GetName(); void SetName( std::string & ); private: std::string m_name; }; } #endif
J'ai la ligne de compilation suivante :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #include "Object.hh" namespace Core { Object::Object( std::string & n ) : m_name(n) { } std::string Object::GetName( void ) { return m_name; } void Object::SetName( std::string & n ) { m_name = n; } }
Et j'ai les warning suivant :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 g++ -O2 -Wuninitialized -W -Wall -pedantic -Werror -g -Wchar-subscripts -Wcomment -Wformat=2 -Wparentheses -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused -Wunknown-pragmas -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wwrite-strings -Wconversion -Wsign-compare -Waggregate-return -Wmissing-noreturn -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations -Wpacked -Wredundant-decls -Winline -Wlong-long -Wunreachable-code -c Object.cc
Sachant que la neuvième ligne est l'accolade fermante du constructeur, j'ai du mal à comprendre pourquoi j'ai un warning ici.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 cc1plus: warnings being treated as errors Object.cc: In constructor Core::Object::Object(std::string&): Object.cc:9: warning: will never be executed Object.cc: In constructor Core::Object::Object(std::string&): Object.cc:9: warning: will never be executed
PS : il s'agit de gcc 4.1.2 sur une debian unstable.
Partager