[scintilla:feature-requests] #1565 Add noexcept to COM methods

0 views
Skip to first unread message

mberchtold

unread,
Jul 15, 2025, 6:16:49 PMJul 15
to scintill...@googlegroups.com

[feature-requests:#1565] Add noexcept to COM methods

Status: open
Group: Initial
Created: Tue Jul 15, 2025 10:16 PM UTC by mberchtold
Last Updated: Tue Jul 15, 2025 10:16 PM UTC
Owner: nobody
Attachments:

This patch adds noexcept to COM interface methods. Typically these are methods with a HRESULT return type, which are not supposed to throw any exceptions. Adding noexcept reduces the number of unwind states.

Affected files:
win32/ScintillaWin.cxx
win32/SurfaceD2D.cxx


Sent from sourceforge.net because scintill...@googlegroups.com is subscribed to https://sourceforge.net/p/scintilla/feature-requests/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/scintilla/admin/feature-requests/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.

Neil Hodgson

unread,
Jul 16, 2025, 3:01:28 AMJul 16
to scintill...@googlegroups.com

I think I looked at this before and there were hassles with deriving noexcept from an interface defined as potentially throwing. As well as Microsoft's interface definitions, there are open source versions and even Microsoft isn't consistent.

Zufu Liu

unread,
Jul 16, 2025, 7:49:46 AMJul 16
to scintill...@googlegroups.com
  • labels: --> Scintilla, win32

[feature-requests:#1565] Add noexcept to COM methods

Status: open
Group: Initial
Labels: Scintilla win32

Created: Tue Jul 15, 2025 10:16 PM UTC by mberchtold

Last Updated: Wed Jul 16, 2025 07:01 AM UTC
Owner: nobody
Attachments:

mberchtold

unread,
Jul 19, 2025, 10:42:43 AMJul 19
to scintill...@googlegroups.com

What specific issues did you encounter? Adding noexcept to COM methods which are final (all the ones in the patch) shouldn't cause any. Some of them (not all) are already annotated with the Microsoft specific declspec(nothrow) attribute.


[feature-requests:#1565] Add noexcept to COM methods

Status: open
Group: Initial
Labels: Scintilla win32

Created: Tue Jul 15, 2025 10:16 PM UTC by mberchtold

Last Updated: Wed Jul 16, 2025 11:49 AM UTC
Owner: nobody
Attachments:

Zufu Liu

unread,
Jul 19, 2025, 8:01:25 PMJul 19
to scintill...@googlegroups.com

[feature-requests:#1565] Add noexcept to COM methods

Status: open
Group: Initial
Labels: Scintilla win32

Created: Tue Jul 15, 2025 10:16 PM UTC by mberchtold

Last Updated: Sat Jul 19, 2025 02:42 PM UTC
Owner: nobody
Attachments:

Neil Hodgson

unread,
Sep 26, 2025, 8:33:23 PMSep 26
to scintill...@googlegroups.com

Tried patch with MinGW 13.2 on Win32 and see:

g++ -DNDEBUG -I ../include -I ../src --std=c++17 -Wpedantic -Wall -Wextra -Wconversion -O3  -c SurfaceD2D.cxx -o SurfaceD2D.o
SurfaceD2D.cxx:963:48: error: declaration of 'virtual HRESULT {anonymous}::BlobInline::Draw(void*, IDWriteTextRenderer*, FLOAT, FLOAT, BOOL, BOOL, IUnknown*)' has a different exception specifier
  963 | COM_DECLSPEC_NOTHROW HRESULT STDMETHODCALLTYPE BlobInline::Draw(
      |                                                ^~~~~~~~~~
SurfaceD2D.cxx:918:43: note: from previous declaration 'virtual HRESULT {anonymous}::BlobInline::Draw(void*, IDWriteTextRenderer*, FLOAT, FLOAT, BOOL, BOOL, IUnknown*) noexcept'
  918 |         COM_DECLSPEC_NOTHROW STDMETHODIMP Draw(
      |                                           ^~~~
SurfaceD2D.cxx:977:48: error: declaration of 'virtual HRESULT {anonymous}::BlobInline::GetMetrics(DWRITE_INLINE_OBJECT_METRICS*)' has a different exception specifier
  977 | COM_DECLSPEC_NOTHROW HRESULT STDMETHODCALLTYPE BlobInline::GetMetrics(
      |                                                ^~~~~~~~~~
SurfaceD2D.cxx:927:43: note: from previous declaration 'virtual HRESULT {anonymous}::BlobInline::GetMetrics(DWRITE_INLINE_OBJECT_METRICS*) noexcept'
  927 |         COM_DECLSPEC_NOTHROW STDMETHODIMP GetMetrics(DWRITE_INLINE_OBJECT_METRICS *metrics) noexcept override;
      |                                           ^~~~~~~~~~
SurfaceD2D.cxx:989:48: error: declaration of 'virtual HRESULT {anonymous}::BlobInline::GetOverhangMetrics(DWRITE_OVERHANG_METRICS*)' has a different exception specifier
  989 | COM_DECLSPEC_NOTHROW HRESULT STDMETHODCALLTYPE BlobInline::GetOverhangMetrics(
      |                                                ^~~~~~~~~~
SurfaceD2D.cxx:928:43: note: from previous declaration 'virtual HRESULT {anonymous}::BlobInline::GetOverhangMetrics(DWRITE_OVERHANG_METRICS*) noexcept'
  928 |         COM_DECLSPEC_NOTHROW STDMETHODIMP GetOverhangMetrics(DWRITE_OVERHANG_METRICS *overhangs) noexcept override;
      |                                           ^~~~~~~~~~~~~~~~~~
SurfaceD2D.cxx:1001:48: error: declaration of 'virtual HRESULT {anonymous}::BlobInline::GetBreakConditions(DWRITE_BREAK_CONDITION*, DWRITE_BREAK_CONDITION*)' has a different exception specifier
 1001 | COM_DECLSPEC_NOTHROW HRESULT STDMETHODCALLTYPE BlobInline::GetBreakConditions(
      |                                                ^~~~~~~~~~
SurfaceD2D.cxx:929:43: note: from previous declaration 'virtual HRESULT {anonymous}::BlobInline::GetBreakConditions(DWRITE_BREAK_CONDITION*, DWRITE_BREAK_CONDITION*) noexcept'
  929 |         COM_DECLSPEC_NOTHROW STDMETHODIMP GetBreakConditions(
      |                                           ^~~~~~~~~~~~~~~~~~
mingw32-make: *** [makefile:75: SurfaceD2D.o] Error 1
mingw32-make: *** Waiting for unfinished jobs....
checkbuilds.bat:1: Failed 2

[feature-requests:#1565] Add noexcept to COM methods

Status: open
Group: Initial
Labels: Scintilla win32
Created: Tue Jul 15, 2025 10:16 PM UTC by mberchtold

Last Updated: Sun Jul 20, 2025 12:01 AM UTC
Owner: nobody
Attachments:

Reply all
Reply to author
Forward
0 new messages