aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2013-09-10 14:44:16 +1000
committerNeil <nyamatongwe@gmail.com>2013-09-10 14:44:16 +1000
commita1edd2b133bf3ae4d263cea2f46aacb4b51fccb5 (patch)
tree95cd567b68fc22493443eedd8b9e86739551d07a
parent790cde271408e20b2ffbbe53670e860582df29e4 (diff)
downloadscintilla-mirror-a1edd2b133bf3ae4d263cea2f46aacb4b51fccb5.tar.gz
Use C++ struct initialization {} so can drop -Wno-missing-braces setting for gcc.
-rw-r--r--gtk/ScintillaGTK.cxx4
-rw-r--r--gtk/makefile2
-rw-r--r--include/Platform.h1
-rw-r--r--src/Editor.cxx34
-rw-r--r--src/ScintillaBase.cxx8
-rw-r--r--win32/PlatWin.cxx7
-rw-r--r--win32/ScintillaWin.cxx3
-rw-r--r--win32/makefile2
8 files changed, 29 insertions, 32 deletions
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx
index 227a33b3f..273333465 100644
--- a/gtk/ScintillaGTK.cxx
+++ b/gtk/ScintillaGTK.cxx
@@ -1218,7 +1218,7 @@ void ScintillaGTK::NotifyParent(SCNotification scn) {
}
void ScintillaGTK::NotifyKey(int key, int modifiers) {
- SCNotification scn = {0};
+ SCNotification scn = {};
scn.nmhdr.code = SCN_KEY;
scn.ch = key;
scn.modifiers = modifiers;
@@ -1227,7 +1227,7 @@ void ScintillaGTK::NotifyKey(int key, int modifiers) {
}
void ScintillaGTK::NotifyURIDropped(const char *list) {
- SCNotification scn = {0};
+ SCNotification scn = {};
scn.nmhdr.code = SCN_URIDROPPED;
scn.text = list;
diff --git a/gtk/makefile b/gtk/makefile
index 0dbe55460..08edbf91f 100644
--- a/gtk/makefile
+++ b/gtk/makefile
@@ -46,7 +46,7 @@ INCLUDEDIRS=-I ../include -I ../src -I ../lexlib
ifdef CHECK_DEPRECATED
DEPRECATED=-DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DDISABLE_GDK_FONT
endif
-CXXBASEFLAGS=-Wall -Wno-missing-braces -pedantic -DGTK -DSCI_LEXER $(INCLUDEDIRS) $(DEPRECATED)
+CXXBASEFLAGS=-Wall -pedantic -DGTK -DSCI_LEXER $(INCLUDEDIRS) $(DEPRECATED)
ifdef NOTHREADS
THREADFLAGS=-DG_THREADS_IMPL_NONE
diff --git a/include/Platform.h b/include/Platform.h
index f4cbc0538..7f2f37542 100644
--- a/include/Platform.h
+++ b/include/Platform.h
@@ -528,7 +528,6 @@ public:
#endif
#if defined(__GNUC__) && defined(SCINTILLA_QT)
-#pragma GCC diagnostic ignored "-Wmissing-braces"
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif
diff --git a/src/Editor.cxx b/src/Editor.cxx
index afc2983ed..306e375b1 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -4416,7 +4416,7 @@ void Editor::SetCtrlID(int identifier) {
}
void Editor::NotifyStyleToNeeded(int endStyleNeeded) {
- SCNotification scn = {0};
+ SCNotification scn = {};
scn.nmhdr.code = SCN_STYLENEEDED;
scn.position = endStyleNeeded;
NotifyParent(scn);
@@ -4434,14 +4434,14 @@ void Editor::NotifyErrorOccurred(Document *, void *, int status) {
}
void Editor::NotifyChar(int ch) {
- SCNotification scn = {0};
+ SCNotification scn = {};
scn.nmhdr.code = SCN_CHARADDED;
scn.ch = ch;
NotifyParent(scn);
}
void Editor::NotifySavePoint(bool isSavePoint) {
- SCNotification scn = {0};
+ SCNotification scn = {};
if (isSavePoint) {
scn.nmhdr.code = SCN_SAVEPOINTREACHED;
} else {
@@ -4451,13 +4451,13 @@ void Editor::NotifySavePoint(bool isSavePoint) {
}
void Editor::NotifyModifyAttempt() {
- SCNotification scn = {0};
+ SCNotification scn = {};
scn.nmhdr.code = SCN_MODIFYATTEMPTRO;
NotifyParent(scn);
}
void Editor::NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt) {
- SCNotification scn = {0};
+ SCNotification scn = {};
scn.nmhdr.code = SCN_DOUBLECLICK;
scn.line = LineFromLocation(pt);
scn.position = PositionFromLocation(pt, true);
@@ -4467,7 +4467,7 @@ void Editor::NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt) {
}
void Editor::NotifyHotSpotDoubleClicked(int position, bool shift, bool ctrl, bool alt) {
- SCNotification scn = {0};
+ SCNotification scn = {};
scn.nmhdr.code = SCN_HOTSPOTDOUBLECLICK;
scn.position = position;
scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) |
@@ -4476,7 +4476,7 @@ void Editor::NotifyHotSpotDoubleClicked(int position, bool shift, bool ctrl, boo
}
void Editor::NotifyHotSpotClicked(int position, bool shift, bool ctrl, bool alt) {
- SCNotification scn = {0};
+ SCNotification scn = {};
scn.nmhdr.code = SCN_HOTSPOTCLICK;
scn.position = position;
scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) |
@@ -4485,7 +4485,7 @@ void Editor::NotifyHotSpotClicked(int position, bool shift, bool ctrl, bool alt)
}
void Editor::NotifyHotSpotReleaseClick(int position, bool shift, bool ctrl, bool alt) {
- SCNotification scn = {0};
+ SCNotification scn = {};
scn.nmhdr.code = SCN_HOTSPOTRELEASECLICK;
scn.position = position;
scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) |
@@ -4495,7 +4495,7 @@ void Editor::NotifyHotSpotReleaseClick(int position, bool shift, bool ctrl, bool
bool Editor::NotifyUpdateUI() {
if (needUpdateUI) {
- SCNotification scn = {0};
+ SCNotification scn = {};
scn.nmhdr.code = SCN_UPDATEUI;
scn.updated = needUpdateUI;
NotifyParent(scn);
@@ -4506,7 +4506,7 @@ bool Editor::NotifyUpdateUI() {
}
void Editor::NotifyPainted() {
- SCNotification scn = {0};
+ SCNotification scn = {};
scn.nmhdr.code = SCN_PAINTED;
NotifyParent(scn);
}
@@ -4514,7 +4514,7 @@ void Editor::NotifyPainted() {
void Editor::NotifyIndicatorClick(bool click, int position, bool shift, bool ctrl, bool alt) {
int mask = pdoc->decorations.AllOnFor(position);
if ((click && mask) || pdoc->decorations.clickNotified) {
- SCNotification scn = {0};
+ SCNotification scn = {};
pdoc->decorations.clickNotified = click;
scn.nmhdr.code = click ? SCN_INDICATORCLICK : SCN_INDICATORRELEASE;
scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | (alt ? SCI_ALT : 0);
@@ -4553,7 +4553,7 @@ bool Editor::NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt) {
}
return true;
}
- SCNotification scn = {0};
+ SCNotification scn = {};
scn.nmhdr.code = SCN_MARGINCLICK;
scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) |
(alt ? SCI_ALT : 0);
@@ -4567,7 +4567,7 @@ bool Editor::NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt) {
}
void Editor::NotifyNeedShown(int pos, int len) {
- SCNotification scn = {0};
+ SCNotification scn = {};
scn.nmhdr.code = SCN_NEEDSHOWN;
scn.position = pos;
scn.length = len;
@@ -4575,7 +4575,7 @@ void Editor::NotifyNeedShown(int pos, int len) {
}
void Editor::NotifyDwelling(Point pt, bool state) {
- SCNotification scn = {0};
+ SCNotification scn = {};
scn.nmhdr.code = state ? SCN_DWELLSTART : SCN_DWELLEND;
scn.position = PositionFromLocation(pt, true);
scn.x = pt.x + vs.ExternalMarginWidth();
@@ -4584,7 +4584,7 @@ void Editor::NotifyDwelling(Point pt, bool state) {
}
void Editor::NotifyZoom() {
- SCNotification scn = {0};
+ SCNotification scn = {};
scn.nmhdr.code = SCN_ZOOM;
NotifyParent(scn);
}
@@ -4776,7 +4776,7 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) {
NotifyChange(); // Send EN_CHANGE
}
- SCNotification scn = {0};
+ SCNotification scn = {};
scn.nmhdr.code = SCN_MODIFIED;
scn.position = mh.position;
scn.modificationType = mh.modificationType;
@@ -4918,7 +4918,7 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lPar
}
// Send notification
- SCNotification scn = {0};
+ SCNotification scn = {};
scn.nmhdr.code = SCN_MACRORECORD;
scn.message = iMessage;
scn.wParam = wParam;
diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx
index 75f0d5a16..b06f72836 100644
--- a/src/ScintillaBase.cxx
+++ b/src/ScintillaBase.cxx
@@ -289,7 +289,7 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
void ScintillaBase::AutoCompleteCancel() {
if (ac.Active()) {
- SCNotification scn = {0};
+ SCNotification scn = {};
scn.nmhdr.code = SCN_AUTOCCANCELLED;
scn.wParam = 0;
scn.listType = 0;
@@ -325,7 +325,7 @@ void ScintillaBase::AutoCompleteCharacterDeleted() {
} else {
AutoCompleteMoveToCurrentWord();
}
- SCNotification scn = {0};
+ SCNotification scn = {};
scn.nmhdr.code = SCN_AUTOCCHARDELETED;
scn.wParam = 0;
scn.listType = 0;
@@ -342,7 +342,7 @@ void ScintillaBase::AutoCompleteCompleted() {
ac.Show(false);
- SCNotification scn = {0};
+ SCNotification scn = {};
scn.nmhdr.code = listType > 0 ? SCN_USERLISTSELECTION : SCN_AUTOCSELECTION;
scn.message = 0;
scn.wParam = listType;
@@ -434,7 +434,7 @@ void ScintillaBase::CallTipShow(Point pt, const char *defn) {
}
void ScintillaBase::CallTipClick() {
- SCNotification scn = {0};
+ SCNotification scn = {};
scn.nmhdr.code = SCN_CALLTIPCLICK;
scn.position = ct.clickPlace;
NotifyParent(scn);
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 0c690fd7c..3f8c32eb6 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -212,8 +212,7 @@ struct FormatAndMetrics {
};
HFONT FormatAndMetrics::HFont() {
- LOGFONTW lf;
- memset(&lf, 0, sizeof(lf));
+ LOGFONTW lf = {};
#if defined(USE_D2D)
if (technology == SCWIN_TECH_GDI) {
if (0 == ::GetObjectW(hfont, sizeof(lf), &lf)) {
@@ -782,7 +781,7 @@ void SurfaceGDI::AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fil
int height = rc.Height();
// Ensure not distorted too much by corners when small
cornerSize = Platform::Minimum(cornerSize, (Platform::Minimum(width, height) / 2) - 2);
- BITMAPINFO bpih = {sizeof(BITMAPINFOHEADER), width, height, 1, 32, BI_RGB, 0, 0, 0, 0, 0};
+ BITMAPINFO bpih = {{sizeof(BITMAPINFOHEADER), width, height, 1, 32, BI_RGB, 0, 0, 0, 0, 0}};
void *image = 0;
HBITMAP hbmMem = CreateDIBSection(reinterpret_cast<HDC>(hMemDC), &bpih,
DIB_RGB_COLORS, &image, NULL, 0);
@@ -845,7 +844,7 @@ void SurfaceGDI::DrawRGBAImage(PRectangle rc, int width, int height, const unsig
rc.top += static_cast<int>((rc.Height() - height) / 2);
rc.bottom = rc.top + height;
- BITMAPINFO bpih = {sizeof(BITMAPINFOHEADER), width, height, 1, 32, BI_RGB, 0, 0, 0, 0, 0};
+ BITMAPINFO bpih = {{sizeof(BITMAPINFOHEADER), width, height, 1, 32, BI_RGB, 0, 0, 0, 0, 0}};
unsigned char *image = 0;
HBITMAP hbmMem = CreateDIBSection(reinterpret_cast<HDC>(hMemDC), &bpih,
DIB_RGB_COLORS, reinterpret_cast<void **>(&image), NULL, 0);
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index c3222435e..03106b769 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -2283,8 +2283,7 @@ void ScintillaWin::ScrollMessage(WPARAM wParam) {
//DWORD dwStart = timeGetTime();
//Platform::DebugPrintf("Scroll %x %d\n", wParam, lParam);
- SCROLLINFO sci;
- memset(&sci, 0, sizeof(sci));
+ SCROLLINFO sci = {};
sci.cbSize = sizeof(sci);
sci.fMask = SIF_ALL;
diff --git a/win32/makefile b/win32/makefile
index 159d66fdf..9ddfd594a 100644
--- a/win32/makefile
+++ b/win32/makefile
@@ -26,7 +26,7 @@ ifneq "$(shell g++ -c CheckD2D.cxx 2>&1)" ""
D2DFLAGS=-DDISABLE_D2D
endif
-CXXBASEFLAGS=--std=c++0x -Wall -Wno-missing-braces -pedantic $(INCLUDEDIRS) -fno-rtti $(D2DFLAGS)
+CXXBASEFLAGS=--std=c++0x -Wall -pedantic $(INCLUDEDIRS) -fno-rtti $(D2DFLAGS)
ifdef DEBUG
CXXFLAGS=-DDEBUG -g $(CXXBASEFLAGS)