psemiletov / tea-qt

TEA text editor
https://tea.ourproject.org
GNU General Public License v3.0
89 stars 13 forks source link

error: expected member name or ';' after declaration specifiers #35

Closed ryandesign closed 4 years ago

ryandesign commented 4 years ago

tea 50.0.4 doesn't build using Apple LLVM version 9.1.0 (clang-902.0.39.2), which is the version of clang included with Xcode 9.4.1 on macOS 10.13.6. Errors include:

./spellchecker.h:48:60: error: expected member name or ';' after declaration specifiers
                 const QString &user): initialized {false} {};
                                                           ^
./spellchecker.h:48:52: error: expected '('
                 const QString &user): initialized {false} {};
                                                   ^
./spellchecker.h:48:58: error: expected ';' after expression
                 const QString &user): initialized {false} {};
                                                         ^
                                                         ;
./spellchecker.h:48:53: warning: expression result unused [-Wunused-value]
                 const QString &user): initialized {false} {};
                                                    ^~~~~
./spellchecker.h:46:33: warning: unused parameter 'lang' [-Wunused-parameter]
  CSpellchecker (const QString &lang,
                                ^
./spellchecker.h:47:33: warning: unused parameter 'path' [-Wunused-parameter]
                 const QString &path,
                                ^
./spellchecker.h:48:33: warning: unused parameter 'user' [-Wunused-parameter]
                 const QString &user): initialized {false} {};
                                ^
rvln.cpp:2345:93: warning: unused parameter 'previous' [-Wunused-parameter]
void rvln::slot_lv_menuitems_currentItemChanged (QListWidgetItem *current, QListWidgetItem *previous)
                                                                                            ^
rvln.cpp:4906:36: warning: unused parameter 'exitCode' [-Wunused-parameter]
void rvln::cb_script_finished (int exitCode, QProcess::ExitStatus exitStatus)
                                   ^
rvln.cpp:4906:67: warning: unused parameter 'exitStatus' [-Wunused-parameter]
void rvln::cb_script_finished (int exitCode, QProcess::ExitStatus exitStatus)
                                                                  ^
rvln.cpp:7916:45: warning: unused parameter 'year' [-Wunused-parameter]
void rvln::calendar_currentPageChanged (int year, int month)
                                            ^
rvln.cpp:7916:55: warning: unused parameter 'month' [-Wunused-parameter]
void rvln::calendar_currentPageChanged (int year, int month)
                                                      ^
11 warnings and 3 errors generated.
calendar.cpp:189:115: error: expected '('
CCalendarWidget::CCalendarWidget (QWidget *parent, const QString &a_dir_days): QCalendarWidget (parent), dir_days {a_dir_days}
                                                                                                                  ^
calendar.cpp:189:126: error: expected ';' after expression
CCalendarWidget::CCalendarWidget (QWidget *parent, const QString &a_dir_days): QCalendarWidget (parent), dir_days {a_dir_days}
                                                                                                                             ^
                                                                                                                             ;
calendar.cpp:189:116: warning: expression result unused [-Wunused-value]
CCalendarWidget::CCalendarWidget (QWidget *parent, const QString &a_dir_days): QCalendarWidget (parent), dir_days {a_dir_days}
                                                                                                                   ^~~~~~~~~~
calendar.cpp:190:1: error: expected unqualified-id
{
^
1 warning and 3 errors generated.

It builds fine using open source clang 6 and later on the same system, but not with open source clang 5 or earlier.

tea 49.0.0 built fine using Xcode clang on this system. Have the compiler requirements of tea increased? Do you now require a newer C++ language standard than you did before? I see references to C++11 in meson.build (which I'm not using) and tea-qmake.pro, but the flag -std=c++11 is not being given to the compiler. If I manually add -std=c++11 to CXXFLAGS then it builds fine with Xcode clang.

psemiletov commented 4 years ago

I hope I've fixed it at the last commit. Thank you for the report!

ryandesign commented 4 years ago

Thank you, 2a9be2d47bf402f4aa9370ca249cab094a472329 helped. I then ran into a similar error with document.cpp:

document.cpp:526:141: error: expected '('
CSyntaxHighlighter::CSyntaxHighlighter (QTextDocument *parent, CDocument *doc, const QString &fname): QSyntaxHighlighter (parent), document {doc}
                                                                                                                                            ^

Following your lead, making a similar change there allowed the build to succeed. I've submitted this in PR #36.

psemiletov commented 4 years ago

Got it, thanks! Fixed.