I tried to compile LyX with -pedantic option. Most warnings are easy to fix. See the attached patch.
But one isn't that easy: src/frontends/qt4/GuiProgressView.cpp: In member function 'void lyx::frontend::GuiProgressView::debugSelectionChanged()': src/frontends/qt4/GuiProgressView.cpp:149: warning: overflow in implicit constant conversion Should we try to fix these warnings? Stephan
Index: src/support/lyxtime.h =================================================================== --- src/support/lyxtime.h (Revision 36891) +++ src/support/lyxtime.h (Arbeitskopie) @@ -27,6 +27,6 @@ */ std::string const formatted_time(time_t t, std::string const & fmt); -}; // namespace lyx +} // namespace lyx #endif // LYXTIME_H Index: src/frontends/Clipboard.h =================================================================== --- src/frontends/Clipboard.h (Revision 36891) +++ src/frontends/Clipboard.h (Arbeitskopie) @@ -39,7 +39,7 @@ LinkBackGraphicsType, EmfGraphicsType, WmfGraphicsType, - AnyGraphicsType, + AnyGraphicsType }; /** Index: src/LyXAction.h =================================================================== --- src/LyXAction.h (Revision 36891) +++ src/LyXAction.h (Arbeitskopie) @@ -37,7 +37,7 @@ Math, //< Mathematics Buffer, //< Buffer and window related Layout, //< Font, Layout and textclass related - System, //< Lyx preference, server etc + System //< Lyx preference, server etc }; private: @@ -65,7 +65,7 @@ NoUpdate = 8, //< Does not (usually) require update SingleParUpdate = 16, //< Usually only requires this par updated AtPoint = 32, //< dispatch first to inset at cursor if there is one - NoInternal = 64, //< Cannot be used for internal, non-document Buffers + NoInternal = 64 //< Cannot be used for internal, non-document Buffers }; LyXAction(); Index: src/Buffer.h =================================================================== --- src/Buffer.h (Revision 36891) +++ src/Buffer.h (Arbeitskopie) @@ -133,8 +133,8 @@ * FIXME: replace this method with support/FileMonitor. */ enum CheckMethod { - checksum_method, ///< Use file checksum - timestamp_method, ///< Use timestamp, and checksum if timestamp has changed + checksum_method, ///< Use file checksum + timestamp_method ///< Use timestamp, and checksum if timestamp has changed }; /// Index: src/insets/Inset.h =================================================================== --- src/insets/Inset.h (Revision 36891) +++ src/insets/Inset.h (Arbeitskopie) @@ -82,7 +82,7 @@ enum EntryDirection { ENTRY_DIRECTION_IGNORE, ENTRY_DIRECTION_RIGHT, - ENTRY_DIRECTION_LEFT, + ENTRY_DIRECTION_LEFT }; /// typedef ptrdiff_t difference_type; Index: src/insets/InsetListingsParams.cpp =================================================================== --- src/insets/InsetListingsParams.cpp (Revision 36891) +++ src/insets/InsetListingsParams.cpp (Arbeitskopie) @@ -36,7 +36,7 @@ INTEGER, // accept an integer LENGTH, // accept a latex length ONEOF, // accept one of a few values - SUBSETOF, // accept a string composed of given characters + SUBSETOF // accept a string composed of given characters }; Index: src/insets/InsetCode.h =================================================================== --- src/insets/InsetCode.h (Revision 36891) +++ src/insets/InsetCode.h (Arbeitskopie) @@ -227,7 +227,7 @@ /// SCRIPT_CODE, /// - INSET_CODE_SIZE, + INSET_CODE_SIZE }; } // namespace lyx Index: src/insets/InsetSpecialChar.h =================================================================== --- src/insets/InsetSpecialChar.h (Revision 36891) +++ src/insets/InsetSpecialChar.h (Arbeitskopie) @@ -41,7 +41,7 @@ /// breakable slash SLASH, /// protected dash - NOBREAKDASH, + NOBREAKDASH }; /// Index: src/insets/InsetInfo.h =================================================================== --- src/insets/InsetInfo.h (Revision 36891) +++ src/insets/InsetInfo.h (Arbeitskopie) @@ -88,7 +88,7 @@ MENU_INFO, // Which menu item is used for certain function ICON_INFO, // which toolbar icon is used for certain function BUFFER_INFO, // Buffer related information - LYX_INFO, // LyX version information + LYX_INFO // LyX version information }; /// Index: src/Format.h =================================================================== --- src/Format.h (Revision 36891) +++ src/Format.h (Arbeitskopie) @@ -33,7 +33,7 @@ /// Some formats are both (e.g. pdf), they have this flag set. document = 1, /// Set if this format can contain vector graphics. - vector = 2, + vector = 2 }; /// Format(std::string const & n, std::string const & e, std::string const & p, Index: src/Trans.cpp =================================================================== --- src/Trans.cpp (Revision 36891) +++ src/Trans.cpp (Arbeitskopie) @@ -170,7 +170,7 @@ KCOMB = 1, KMOD, KMAP, - KXMOD, + KXMOD }; Index: src/KeyMap.cpp =================================================================== --- src/KeyMap.cpp (Revision 36891) +++ src/KeyMap.cpp (Arbeitskopie) @@ -247,7 +247,7 @@ enum { BN_BIND, BN_BINDFILE, - BN_UNBIND, + BN_UNBIND }; LexerKeyword bindTags[] = { Index: src/frontends/qt4/ButtonPolicy.h =================================================================== --- src/frontends/qt4/ButtonPolicy.h (Revision 36891) +++ src/frontends/qt4/ButtonPolicy.h (Arbeitskopie) @@ -161,7 +161,7 @@ to minimise problems to users by supplying an anything-goes policy via a preprocessor directive. */ - IgnorantPolicy, + IgnorantPolicy }; /// Constructor Index: src/frontends/qt4/Toolbars.cpp =================================================================== --- src/frontends/qt4/Toolbars.cpp (Revision 36891) +++ src/frontends/qt4/Toolbars.cpp (Arbeitskopie) @@ -74,7 +74,7 @@ TO_EXPORTFORMATS, TO_IMPORTFORMATS, TO_UPDATEFORMATS, - TO_VIEWFORMATS, + TO_VIEWFORMATS }; struct LexerKeyword toolTags[] = { @@ -267,7 +267,7 @@ { enum { TO_TOOLBAR = 1, - TO_ENDTOOLBARSET, + TO_ENDTOOLBARSET }; struct LexerKeyword toolTags[] = { Index: src/frontends/qt4/GuiPrefs.cpp =================================================================== --- src/frontends/qt4/GuiPrefs.cpp (Revision 36891) +++ src/frontends/qt4/GuiPrefs.cpp (Arbeitskopie) @@ -1833,7 +1833,7 @@ return split(l10n_format, '|'); } -}; // namespace anon +} // namespace anon void PrefFileformats::apply(LyXRC & rc) const Index: src/frontends/qt4/GuiInclude.h =================================================================== --- src/frontends/qt4/GuiInclude.h (Revision 36891) +++ src/frontends/qt4/GuiInclude.h (Arbeitskopie) @@ -66,7 +66,7 @@ /// INCLUDE, /// - LISTINGS, + LISTINGS }; /// void updateLists(); Index: src/frontends/qt4/Menus.cpp =================================================================== --- src/frontends/qt4/Menus.cpp (Revision 36891) +++ src/frontends/qt4/Menus.cpp (Arbeitskopie) @@ -1885,7 +1885,7 @@ enum { md_menu, md_menubar, - md_endmenuset, + md_endmenuset }; LexerKeyword menutags[] = { Index: src/support/AppleSpeller.m =================================================================== --- src/support/AppleSpeller.m (Revision 36891) +++ src/support/AppleSpeller.m (Arbeitskopie) @@ -115,7 +115,7 @@ result = SPELL_CHECK_LEARNED; } } else { - int capacity = [speller->misspelled count] + 1; + NSUInteger capacity = [speller->misspelled count] + 1; NSMutableArray * misspelled = [NSMutableArray arrayWithCapacity:capacity]; [misspelled addObjectsFromArray:speller->misspelled]; [misspelled addObject:[NSValue valueWithRange:match]]; @@ -233,7 +233,7 @@ void AppleSpeller_misspelledWord(AppleSpeller speller, int index, int * start, int * length) { - NSRange range = [[speller->misspelled objectAtIndex:index] rangeValue]; + NSRange range = [[speller->misspelled objectAtIndex:(NSUInteger)index] rangeValue]; *start = range.location; *length = range.length; } Index: src/support/linkback/LinkBackServer.m =================================================================== --- src/support/linkback/LinkBackServer.m (Revision 36891) +++ src/support/linkback/LinkBackServer.m (Arbeitskopie) @@ -72,7 +72,7 @@ BOOL LinkBackServerIsSupported(NSString* name, id supportedServers) { BOOL ret = NO ; - int idx ; + NSUInteger idx ; NSString* curServer = supportedServers ; // NOTE: supportedServers may be nil, an NSArray, or NSString. @@ -99,7 +99,7 @@ #else NSArray* contents = [fm directoryContentsAtPath: dir] ; #endif - int idx ; + NSUInteger idx ; NSLog(@"searching for %@ in folder: %@", serverName, dir) ; @@ -173,7 +173,7 @@ } } -+ (LinkBackServer*)LinkBackServerWithName:(NSString*)aName inApplication:(NSString*)bundleIdentifier launchIfNeeded:(BOOL)flag fallbackURL:(NSURL*)url appName:(NSString*)appName ; ++ (LinkBackServer*)LinkBackServerWithName:(NSString*)aName inApplication:(NSString*)bundleIdentifier launchIfNeeded:(BOOL)flag fallbackURL:(NSURL*)url appName:(NSString*)appName { BOOL connect = YES ; NSString* serverName = MakeLinkBackServerName(bundleIdentifier, aName) ; Index: src/support/linkback/LinkBack.m =================================================================== --- src/support/linkback/LinkBack.m (Revision 36891) +++ src/support/linkback/LinkBack.m (Arbeitskopie) @@ -103,7 +103,7 @@ + (NSDictionary*)linkBackDataWithServerName:(NSString*)serverName appData:(id)appData { - return [self linkBackDataWithServerName: serverName appData: appData actionName: nil suggestedRefreshRate: 0]; + return [self linkBackDataWithServerName: serverName appData: appData actionName: nil suggestedRefreshRate: (float)0]; } + (NSDictionary*)linkBackDataWithServerName:(NSString*)serverName appData:(id)appData suggestedRefreshRate:(NSTimeInterval)rate @@ -111,7 +111,7 @@ return [self linkBackDataWithServerName: serverName appData: appData actionName: LinkBackRefreshActionName suggestedRefreshRate: rate] ; } -+ (NSDictionary*)linkBackDataWithServerName:(NSString*)serverName appData:(id)appData actionName:(NSString*)action suggestedRefreshRate:(NSTimeInterval)rate ; ++ (NSDictionary*)linkBackDataWithServerName:(NSString*)serverName appData:(id)appData actionName:(NSString*)action suggestedRefreshRate:(NSTimeInterval)rate { NSDictionary* appInfo = [[NSBundle mainBundle] infoDictionary] ; @@ -133,7 +133,7 @@ if (action) [ret setObject: action forKey: LinkBackServerActionKey] ; if (appData) [ret setObject: appData forKey: LinkBackApplicationDataKey] ; if (url) [ret setObject: url forKey: LinkBackApplicationURLKey] ; - [ret setObject: [NSNumber numberWithFloat: rate] forKey: LinkBackSuggestedRefreshKey] ; + [ret setObject: [NSNumber numberWithFloat: (float)rate] forKey: LinkBackSuggestedRefreshKey] ; return [ret autorelease] ; } @@ -236,7 +236,7 @@ return self ; } -- (id)initClientWithSourceName:(NSString*)aName delegate:(id<LinkBackClientDelegate>)aDel itemKey:(NSString*)aKey ; +- (id)initClientWithSourceName:(NSString*)aName delegate:(id<LinkBackClientDelegate>)aDel itemKey:(NSString*)aKey { if ((self = [super init])) { isServer = NO ; Index: src/support/linkback/LinkBackProxy.m =================================================================== --- src/support/linkback/LinkBackProxy.m (Revision 36891) +++ src/support/linkback/LinkBackProxy.m (Arbeitskopie) @@ -158,7 +158,7 @@ NSLog(@"LinkBack file %@ disappeared.", fileName); return; } - [file truncateFileAtOffset:0]; + [file truncateFileAtOffset:(unsigned long long)0]; [file writeData:pdfData]; [file writeData:linkBackData]; Index: src/support/lstrings.cpp =================================================================== --- src/support/lstrings.cpp (Revision 36891) +++ src/support/lstrings.cpp (Arbeitskopie) @@ -374,9 +374,7 @@ int hexToInt(docstring const & str) { string s = to_ascii(str); - int h; - sscanf(s.c_str(), "%x", &h); - return h; + return strtol(s.c_str(), NULL, 16); } Index: src/Paragraph.cpp =================================================================== --- src/Paragraph.cpp (Revision 36891) +++ src/Paragraph.cpp (Arbeitskopie) @@ -72,7 +72,7 @@ namespace { /// Inset identifier (above 0x10ffff, for ucs-4) char_type const META_INSET = 0x200001; -}; +} ///////////////////////////////////////////////////////////////////// Index: src/Encoding.cpp =================================================================== --- src/Encoding.cpp (Revision 36891) +++ src/Encoding.cpp (Arbeitskopie) @@ -825,7 +825,7 @@ // Now read the encodings enum { et_encoding = 1, - et_end, + et_end }; LexerKeyword encodingtags[] = {