Opened 3 years ago

Closed 3 years ago

#12745 closed bug (fixed)

[Patch] SMTP.cpp: fix gcc6 build

Reported by: mt Owned by: czeidler
Priority: normal Milestone: Unscheduled
Component: Kits/Mail Kit Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: yes Platform: All

Description

Gcc6 warns '-Werror=misleading-indentation', so add curly braces to fix it.

/home/haiku/haiku/haiku/src/add-ons/mail_daemon/outbound_protocols/smtp/SMTP.cpp: In member function 'status_t SMTPProtocol::Send(const char*, const char*, BPositionIO*)':
/home/haiku/haiku/haiku/src/add-ons/mail_daemon/outbound_protocols/smtp/SMTP.cpp:913:37: error: this 'else' clause does not guard... [-Werror=misleading-indentation]
                                     else
                                     ^~~~
/home/haiku/haiku/haiku/src/add-ons/mail_daemon/outbound_protocols/smtp/SMTP.cpp:916:6: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'else'
      ReportProgress (bufferLen,0);
      ^~~~~~~~~~~~~~
/home/haiku/haiku/haiku/src/add-ons/mail_daemon/outbound_protocols/smtp/SMTP.cpp:931:31: error: this 'else' clause does not guard... [-Werror=misleading-indentation]
                             } else
                               ^~~~
/home/haiku/haiku/haiku/src/add-ons/mail_daemon/outbound_protocols/smtp/SMTP.cpp:935:5: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'else'
     ReportProgress (bufferLen - 3,0);
     ^~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors

Attachments (2)

0004-SMTP.cpp-fix-gcc6-build.patch (2.1 KB ) - added by mt 3 years ago.
0003-SMTP.cpp-fix-gcc6-build.patch (2.4 KB ) - added by mt 3 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 by mt, 3 years ago

Has a Patch: set

comment:2 by korli, 3 years ago

LGTM, but maybe needs another +1.

comment:3 by axeld, 3 years ago

I think I'd prefer to move the send() call into either a local macro, or an extra method, like this:

ssize_t
SMTPProtocol::_SendData(const void* data, size_t length)
{
#ifdef USE_SSL
    if (use_ssl)
        return SSL_write(ssl, data, length);
#endif
    return send(fSocket, data, length);
}

in reply to:  3 comment:4 by mt, 3 years ago

Replying to axeld:

I think I'd prefer to move the send() call into either a local macro, or an extra method, like this:

Hi axeld, I update patch.

comment:5 by waddlesplash, 3 years ago

Resolution: fixed
Status: newclosed

Applied in hrev50308. Thanks!

Note: See TracTickets for help on using tickets.