[LLVMbugs] [Bug 19833] New: macro suggest placement of missing semi colon

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu May 22 20:14:27 PDT 2014


            Bug ID: 19833
           Summary: macro suggest placement of missing semi colon
           Product: clang
           Version: 3.4
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sreich at kde.org
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

main.cpp.cpp:69:5: error: called object type 'void' is not a function or
function pointer
        Q_ASSERT(startX >= 0);
    /usr/include/qt/QtCore/qglobal.h:645:28: note: expanded from macro
    #    define Q_ASSERT(cond) ((!(cond)) ? qt_assert(#cond,__FILE__,__LINE__)
: qt_noop())
    1 error generated.

        const uint32_t startX;

        Q_ASSERT(startX >= 0);

So what this ends up expanding to is essentially (missingsemi)(startX), and
since they are void we receive that error.

I am not aware of a method to improve the macro to help warn or error out on
missing semi colons in such a case (it'd be nice if we could static assert or
something. perhaps it's possible to static_assert that the type is not void?)

I was wondering if perhaps this was applicable to other scenarios in a
non-deadly way. That is, having the syntax suggestion messages say something
like "did you forget the semi colon", etc., iff it does not compile properly
via other means.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140523/c38edb33/attachment.html>

More information about the llvm-bugs mailing list