[llvm-bugs] [Bug 45245] New: Optional Parameter Argument Preprocessor trick fails for objc_method_family (init) methods
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Mar 18 16:28:34 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=45245
Bug ID: 45245
Summary: Optional Parameter Argument Preprocessor trick fails
for objc_method_family (init) methods
Product: clang
Version: unspecified
Hardware: Macintosh
OS: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: dmaclach at gmail.com
CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
richard-llvm at metafoo.co.uk
Created attachment 23256
--> https://bugs.llvm.org/attachment.cgi?id=23256&action=edit
Code for repro case.
There is a "trick" described at
https://stackoverflow.com/questions/3046889/optional-parameters-with-c-macros
for doing optional parameters with c macros.
It is used by the popular https://ocmock.org/ library.
Unfortunately it seems to generate a warning for unused-value that it shouldn't
generate when used with an objc_method_family (init) from within an objc method
implementation.
To repro:
Xcode 11.3 (or Xcode 11.4b3)
clang -Werror -Wunused-value -fobjc-arc main.m
Expected Result: Clean compile
Actual Result:
main.m:30:13: error: expression result unused [-Werror,-Wunused-value]
OCMVerify([object init]);
^~~~~~~~~~~~~
main.m:12:64: note: expanded from macro 'OCMVerify'
#define OCMVerify(...) _OCMVerify_X(,##__VA_ARGS__, _OCMVerify(__VA_ARGS__))
^~~~~~~~~~~
main.m:8:5: note: expanded from macro '_OCMVerify'
invocation; \
^~~~~~~~~~
main.m:11:39: note: expanded from macro '_OCMVerify_X'
#define _OCMVerify_X(x,A,FUNC, ...) FUNC
--
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/20200318/226434d6/attachment-0001.html>
More information about the llvm-bugs
mailing list