There are two serious bugs in rc1 which are caused by uninitialized class
member variables. Therefore I ran cppcheck on master at aea6ddfcb96.
Unfortunately I ran out of time, so I could not yet completely analyze the
result, but in case somebody else wants to do that I attach the result of
"cppcheck --enable=all src".
I already found out that the two "Null pointer dereference" warnings are no
problem (although this construct is fragile and can hopefully be removed in
the future). I don't know which of the many uninitialized members are a
problem, I even don't know if all messages are correct. I do not propose to
initialize all these variables, but if we find out that some of them are
dangerous we should add an initialization.
Georg
[src/SpellChecker.h:29]: (style) The class 'SpellChecker' does not have a
constructor.
[src/Language.h:34]: (warning) Member variable 'Language::encoding_' is not
initialized in the constructor.
[src/Language.h:34]: (warning) Member variable 'Language::internal_enc_' is not
initialized in the constructor.
[src/Language.h:34]: (warning) Member variable 'Language::as_babel_options_' is
not initialized in the constructor.
[src/support/debug.h:145]: (warning) Member variable 'LyXErr::dt_' is not
initialized in the constructor.
[src/support/debug.h:145]: (warning) Member variable 'LyXErr::stream_' is not
initialized in the constructor.
[src/support/debug.h:145]: (warning) Member variable 'LyXErr::second_stream_'
is not initialized in the constructor.
[src/Author.h:25]: (warning) Member variable 'Author::used_' is not initialized
in the constructor.
[src/Author.h:25]: (warning) Member variable 'Author::buffer_id_' is not
initialized in the constructor.
[src/PersonalWordList.h:27]: (warning) Member variable
'PersonalWordList::dirty_' is not initialized in the constructor.
[src/support/Package.h:54]: (warning) Member variable
'Package::explicit_user_support_dir_' is not initialized in the constructor.
[src/support/Package.h:54]: (warning) Member variable 'Package::in_build_dir_'
is not initialized in the constructor.
[src/Encoding.h:60]: (warning) Member variable 'CharInfo::flags_' is not
initialized in the constructor.
[src/Encoding.h:124]: (warning) Member variable 'Encoding::fixedwidth_' is not
initialized in the constructor.
[src/Encoding.h:124]: (warning) Member variable 'Encoding::unsafe_' is not
initialized in the constructor.
[src/Encoding.h:124]: (warning) Member variable 'Encoding::package_' is not
initialized in the constructor.
[src/Encoding.h:124]: (warning) Member variable 'Encoding::complete_' is not
initialized in the constructor.
[src/TocBackend.h:41]: (warning) Member variable 'TocItem::depth_' is not
initialized in the constructor.
[src/TocBackend.h:41]: (warning) Member variable 'TocItem::output_' is not
initialized in the constructor.
[src/insets/Inset.h:112]: (error) Null pointer dereference
[src/Bidi.h:30]: (style) The class 'Bidi' does not have a constructor.
[src/LaTeX.h:148]: (error) Analysis failed. If the code is valid then please
report this failure.
[src/LaTeXFonts.h:29]: (warning) Member variable 'LaTeXFont::osfdefault_' is
not initialized in the constructor.
[src/lyxfind.h:99]: (warning) Member variable
'FindAndReplaceOptions::casesensitive' is not initialized in the constructor.
[src/lyxfind.h:99]: (warning) Member variable
'FindAndReplaceOptions::matchword' is not initialized in the constructor.
[src/lyxfind.h:99]: (warning) Member variable 'FindAndReplaceOptions::forward'
is not initialized in the constructor.
[src/lyxfind.h:99]: (warning) Member variable
'FindAndReplaceOptions::expandmacros' is not initialized in the constructor.
[src/lyxfind.h:99]: (warning) Member variable
'FindAndReplaceOptions::ignoreformat' is not initialized in the constructor.
[src/lyxfind.h:99]: (warning) Member variable
'FindAndReplaceOptions::keep_case' is not initialized in the constructor.
[src/lyxfind.h:99]: (warning) Member variable 'FindAndReplaceOptions::scope' is
not initialized in the constructor.
[src/lyxfind.h:99]: (warning) Member variable 'FindAndReplaceOptions::restr' is
not initialized in the constructor.
[src/ParagraphMetrics.h:48]: (warning) Member variable
'ParagraphMetrics::position_' is not initialized in the constructor.
[src/TextMetrics.h:36]: (warning) Member variable 'TextMetrics::bv_' is not
initialized in the constructor.
[src/TextMetrics.h:36]: (warning) Member variable 'TextMetrics::main_text_' is
not initialized in the constructor.
[src/TextMetrics.h:36]: (warning) Member variable 'TextMetrics::max_width_' is
not initialized in the constructor.
[src/insets/RenderBase.h:56]: (warning) Member variable 'RenderBase::dim_' is
not initialized in the constructor.
[src/insets/RenderBase.h:57]: (warning) Member variable 'RenderBase::state_' is
not assigned a value in 'RenderBase::operator='
[src/insets/RenderBase.h:57]: (warning) Member variable 'RenderBase::dim_' is
not assigned a value in 'RenderBase::operator='
[src/insets/ExternalTransforms.h:333]: (warning) Member variable
'TransformStore::id' is not initialized in the constructor.
[src/frontends/Painter.h:55]: (warning) Member variable 'Painter::line_width'
is not initialized in the constructor.
[src/insets/InsetGraphicsParams.h:73]: (style) 'InsetGraphicsParams::operator='
should return 'InsetGraphicsParams &'
[src/Compare.cpp:387]: (performance) Prefer prefix ++/-- operators for
non-primitive types.
[src/ConverterCache.cpp:57]: (warning) Member variable 'CacheItem::checksum' is
not initialized in the constructor.
[src/mathed/MathData.h:69]: (warning) Member variable 'MathData::minasc_' is
not initialized in the constructor.
[src/mathed/MathData.h:69]: (warning) Member variable 'MathData::mindes_' is
not initialized in the constructor.
[src/mathed/MathData.h:69]: (warning) Member variable 'MathData::slevel_' is
not initialized in the constructor.
[src/mathed/MathData.h:69]: (warning) Member variable 'MathData::sshift_' is
not initialized in the constructor.
[src/mathed/MathData.h:69]: (warning) Member variable 'MathData::kerning_' is
not initialized in the constructor.
[src/Cursor.cpp:638]: (style) The scope of the variable 'new_pos_is_RTL' can be
reduced
[src/Cursor.cpp:738]: (style) The scope of the variable 'new_pos_is_RTL' can be
reduced
[src/Cursor.cpp:256]: (warning) Member variable 'CursorData::autocorrect_' is
not initialized in the constructor.
[src/Cursor.cpp:256]: (warning) Member variable 'CursorData::macromode_' is not
initialized in the constructor.
[src/Cursor.cpp:263]: (warning) Member variable 'CursorData::autocorrect_' is
not initialized in the constructor.
[src/Cursor.cpp:263]: (warning) Member variable 'CursorData::macromode_' is not
initialized in the constructor.
[src/Cursor.cpp:270]: (warning) Member variable 'CursorData::autocorrect_' is
not initialized in the constructor.
[src/Cursor.cpp:270]: (warning) Member variable 'CursorData::macromode_' is not
initialized in the constructor.
[src/Cursor.cpp:279]: (warning) Member variable 'Cursor::beforeDispatchPosX_'
is not initialized in the constructor.
[src/Cursor.cpp:279]: (warning) Member variable 'Cursor::beforeDispatchPosY_'
is not initialized in the constructor.
[src/CutAndPaste.cpp:616]: (error) Null pointer dereference
[src/support/unicode.h:52]: (style) 'IconvProcessor::operator=' should return
'IconvProcessor &'
[src/Floating.cpp:27]: (warning) Member variable 'Floating::usesfloatpkg_' is
not initialized in the constructor.
[src/Floating.cpp:27]: (warning) Member variable 'Floating::ispredefined_' is
not initialized in the constructor.
[src/Lexer.cpp:571]: (warning) Member variable 'Lexer::lastReadOk_' is not
initialized in the constructor.
[src/support/gzstream.h:60]: (warning) Member variable 'gzstreambuf::mode' is
not initialized in the constructor.
[src/LyX.cpp:1476] -> [src/LyX.cpp:1468]: (style) Found duplicate branches for
if and else.
[src/LyXRC.cpp:227]: (warning) Member variable 'LyXRC::full_screen_statusbar'
is not initialized in the constructor.
[src/LyXRC.cpp:227]: (warning) Member variable 'LyXRC::force_paint_single_char'
is not initialized in the constructor.
[src/VCBackend.h:38]: (warning) Member variable 'VCS::vcstatus' is not
initialized in the constructor.
[src/OutputParams.cpp:21]: (warning) Member variable 'OutputParams::intitle' is
not initialized in the constructor.
[src/LyX.cpp]: (information) Interrupted checking because of too many #ifdef
configurations.
[src/insets/InsetSpecialChar.h:48]: (warning) Member variable
'InsetSpecialChar::kind_' is not initialized in the constructor.
[src/ParagraphMetrics.cpp:69]: (warning) Member variable
'ParagraphMetrics::inset_dims_' is not assigned a value in
'ParagraphMetrics::operator='
[src/Paragraph.cpp:2137]: (style) The scope of the variable 'previous_char' can
be reduced
[src/Paragraph.cpp:2138]: (style) The scope of the variable 'temp' can be
reduced
[src/TexStream.cpp:80]: (warning) Member variable 'TexStream::sbuf_' is not
initialized in the constructor.
[src/TexStream.cpp:48]: (warning) Member variable 'TexStreamBuffer::column_' is
not initialized in the constructor.
[src/insets/InsetIPAMacro.h:134]: (warning) Member variable
'InsetIPAChar::kind_' is not initialized in the constructor.
[src/TextClass.cpp:141]: (warning) Member variable
'TextClass::tex_class_avail_' is not initialized in the constructor.
[src/TextClass.cpp:141]: (warning) Member variable 'TextClass::min_toclevel_'
is not initialized in the constructor.
[src/TextClass.cpp:141]: (warning) Member variable 'TextClass::max_toclevel_'
is not initialized in the constructor.
[src/TextMetrics.cpp:1155]: (style) The scope of the variable 'usual' can be
reduced
[src/TextMetrics.cpp:1156]: (style) The scope of the variable 'unusual' can be
reduced
[src/Trans.cpp:430]: (warning) Member variable 'TransFSMData::comb_info_' is
not initialized in the constructor.
[src/Trans.cpp:430]: (warning) Member variable 'TransFSMData::init_state_' is
not initialized in the constructor.
[src/Trans.cpp:430]: (warning) Member variable 'TransFSMData::deadkey_state_'
is not initialized in the constructor.
[src/Trans.cpp:430]: (warning) Member variable 'TransFSMData::combined_state_'
is not initialized in the constructor.
[src/Trans.cpp:430]: (warning) Member variable 'TransFSMData::currentState' is
not initialized in the constructor.
[src/frontends/qt4/FindAndReplace.cpp:113]: (style) Consecutive return, break,
continue, goto or throw statements are unnecessary.
[src/frontends/qt4/GuiSpellchecker.cpp:558]: (style) Throwing a copy of the
caught exception instead of rethrowing the original exception
[src/frontends/qt4/GuiToc.cpp:80]: (style) C-style pointer casting
[src/frontends/qt4/GuiView.cpp:1214]: (style) C-style pointer casting
[src/frontends/qt4/GuiView.cpp:4052]: (style) Throwing a copy of the caught
exception instead of rethrowing the original exception
[src/frontends/qt4/GuiWorkArea.cpp:134]: (warning) Member variable
'CursorWidget::rtl_' is not initialized in the constructor.
[src/frontends/qt4/GuiWorkArea.cpp:134]: (warning) Member variable
'CursorWidget::l_shape_' is not initialized in the constructor.
[src/frontends/qt4/GuiWorkArea.cpp:134]: (warning) Member variable
'CursorWidget::completable_' is not initialized in the constructor.
[src/frontends/qt4/GuiWorkArea.cpp:134]: (warning) Member variable
'CursorWidget::show_' is not initialized in the constructor.
[src/frontends/qt4/GuiWorkArea.cpp:134]: (warning) Member variable
'CursorWidget::x_' is not initialized in the constructor.
[src/frontends/qt4/GuiWorkArea.cpp:1797]: (warning) Member variable
'DisplayPath::tab_' is not initialized in the constructor.
[src/frontends/qt4/GuiWorkArea.cpp:1797]: (warning) Member variable
'DisplayPath::dottedPrefix_' is not initialized in the constructor.
[src/frontends/qt4/TocModel.cpp:81]: (warning) Member variable 'TocModel::toc_'
is not initialized in the constructor.
[src/frontends/qt4/qt_helpers.cpp:80]: (performance) Function parameter 'str'
should be passed by reference.
[src/insets/InsetBibitem.cpp:83]: (style) The scope of the variable 'i' can be
reduced
[src/insets/InsetBibitem.cpp:133]: (style) The scope of the variable 'previous'
can be reduced
[src/insets/InsetBibtex.cpp:106]: (style) Throwing a copy of the caught
exception instead of rethrowing the original exception
[src/insets/InsetCollapsable.cpp:56]: (warning) Member variable
'InsetCollapsable::auto_open_' is not initialized in the constructor.
[src/insets/InsetCollapsable.cpp:56]: (warning) Member variable
'InsetCollapsable::mouse_hover_' is not initialized in the constructor.
[src/insets/InsetCommand.cpp:63]: (warning) Member variable
'InsetCommand::mouse_hover_' is not initialized in the constructor.
[src/insets/InsetCommand.cpp:63]: (warning) Member variable
'InsetCommand::button_' is not initialized in the constructor.
[src/insets/InsetLayout.h:177]: (style) Unused private function
'InsetLayout::defaultCSSLabelClass'
[src/insets/InsetLine.cpp:47]: (warning) Member variable 'InsetLine::height_'
is not initialized in the constructor.
[src/insets/InsetLine.cpp:47]: (warning) Member variable 'InsetLine::offset_'
is not initialized in the constructor.
[src/insets/InsetNomencl.cpp:177]: (warning) Member variable
'NomenclEntry::par' is not initialized in the constructor.
[src/insets/InsetRef.cpp:45]: (warning) Member variable
'InsetRef::screen_label_' is not initialized in the constructor.
[src/insets/InsetRef.cpp:45]: (warning) Member variable 'InsetRef::tooltip_' is
not initialized in the constructor.
[src/insets/InsetQuotes.cpp:348]: (style) Variable 'use_babel' is assigned a
value that is never used
[src/insets/InsetTabular.cpp:879] -> [src/insets/InsetTabular.cpp:879]: (style)
Same expression on both sides of '&&'.
[src/insets/InsetTabular.cpp:658]: (warning) Member variable 'ltType::set' is
not initialized in the constructor.
[src/mathed/InsetMathColor.cpp:27]: (warning) Member variable
'InsetMathColor::w_' is not initialized in the constructor.
[src/mathed/InsetMathColor.cpp:33]: (warning) Member variable
'InsetMathColor::w_' is not initialized in the constructor.
[src/mathed/InsetMathDecoration.cpp:35]: (warning) Member variable
'InsetMathDecoration::dh_' is not initialized in the constructor.
[src/mathed/InsetMathDecoration.cpp:35]: (warning) Member variable
'InsetMathDecoration::dy_' is not initialized in the constructor.
[src/mathed/InsetMathDecoration.cpp:35]: (warning) Member variable
'InsetMathDecoration::dw_' is not initialized in the constructor.
[src/mathed/InsetMathDecoration.cpp:174]: (warning) Member variable
'Attributes::over' is not initialized in the constructor.
[src/mathed/InsetMathDelim.cpp:44]: (warning) Member variable
'InsetMathDelim::dw_' is not initialized in the constructor.
[src/mathed/InsetMathDelim.cpp:50]: (warning) Member variable
'InsetMathDelim::dw_' is not initialized in the constructor.
[src/mathed/InsetMathDots.cpp:27]: (warning) Member variable
'InsetMathDots::dh_' is not initialized in the constructor.
[src/lyxfind.cpp:1097] -> [src/lyxfind.cpp:1097]: (style) Same expression on
both sides of '&&'.
[src/lyxfind.cpp:352]: (style) The scope of the variable 'replace_count' can be
reduced
[src/mathed/InsetMathGrid.cpp:83]: (warning) Member variable 'CellInfo::glue_'
is not initialized in the constructor.
[src/mathed/InsetMathGrid.cpp:92]: (warning) Member variable
'RowInfo::descent_' is not initialized in the constructor.
[src/mathed/InsetMathGrid.cpp:92]: (warning) Member variable 'RowInfo::ascent_'
is not initialized in the constructor.
[src/mathed/InsetMathGrid.cpp:92]: (warning) Member variable 'RowInfo::offset_'
is not initialized in the constructor.
[src/mathed/InsetMathGrid.cpp:110]: (warning) Member variable 'ColInfo::width_'
is not initialized in the constructor.
[src/mathed/InsetMathGrid.cpp:110]: (warning) Member variable
'ColInfo::offset_' is not initialized in the constructor.
[src/mathed/InsetMathGrid.cpp:110]: (warning) Member variable 'ColInfo::skip_'
is not initialized in the constructor.
[src/mathed/InsetMathHull.cpp:150]: (warning) Member variable
'InsetMathHull::use_preview_' is not initialized in the constructor.
[src/mathed/InsetMathHull.cpp:165]: (warning) Member variable
'InsetMathHull::use_preview_' is not initialized in the constructor.
[src/mathed/InsetMathNest.cpp:89]: (warning) Member variable
'InsetMathNest::mouse_hover_' is not initialized in the constructor.
[src/mathed/InsetMathPhantom.cpp:349] -> [src/mathed/InsetMathPhantom.cpp:349]:
(style) Same expression on both sides of '||'.
[src/mathed/InsetMathSymbol.cpp:31]: (warning) Member variable
'InsetMathSymbol::kerning_' is not initialized in the constructor.
[src/mathed/InsetMathSymbol.cpp:36]: (warning) Member variable
'InsetMathSymbol::kerning_' is not initialized in the constructor.
[src/mathed/InsetMathSymbol.cpp:41]: (warning) Member variable
'InsetMathSymbol::kerning_' is not initialized in the constructor.
[src/mathed/InsetMathXYArrow.cpp:24]: (warning) Member variable
'InsetMathXYArrow::up_' is not initialized in the constructor.
[src/mathed/InsetMathXYArrow.cpp:24]: (warning) Member variable
'InsetMathXYArrow::target_' is not initialized in the constructor.
[src/mathed/MathData.cpp:50]: (warning) Member variable 'MathData::minasc_' is
not initialized in the constructor.
[src/mathed/MathData.cpp:50]: (warning) Member variable 'MathData::mindes_' is
not initialized in the constructor.
[src/mathed/MathData.cpp:50]: (warning) Member variable 'MathData::slevel_' is
not initialized in the constructor.
[src/mathed/MathData.cpp:50]: (warning) Member variable 'MathData::sshift_' is
not initialized in the constructor.
[src/mathed/MathData.cpp:50]: (warning) Member variable 'MathData::kerning_' is
not initialized in the constructor.
[src/rowpainter.cpp:568]: (style) Variable 'y_top' is assigned a value that is
never used
[src/support/lstrings.cpp:385]: (warning) scanf without field width limits can
crash with huge input data
[src/support/mythes/mythes.cxx:207]: (style) C-style pointer casting
[src/tex2lyx/table.cpp:150]: (warning) Member variable 'ltType::set' is not
initialized in the constructor.