[llvm-bugs] [Bug 31640] New: diagnose_if generates better diagnostics as a warning

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 13 16:50:05 PST 2017


https://llvm.org/bugs/show_bug.cgi?id=31640

            Bug ID: 31640
           Summary: diagnose_if generates better diagnostics as a warning
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: eric at efcs.ca
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

Currently diagnose_if produces entirely different diagnostics when used as an
error instead of a warning. The error diagnostic is equivalent to an
"unavailable(msg)" diagnostic while the warning simply generates "warning:
msg".

I believe the error diagnostic is misleading and should be change to match the
warning diagnostics.

Example:


void foo(int i) __attribute__((diagnose_if(i, "my warning", "warning"))) {}
void foo(long i) {}

void bar(int i) __attribute__((diagnose_if(i, "my error", "error"))) {}
void bar(long i) {}

int main() {
  foo(1); // expected-warning {{my warning}}
  bar(1); // expected-error {{call to unavailable function 'bar'}}
}

-- 
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/20170114/6a9be0dc/attachment-0001.html>


More information about the llvm-bugs mailing list