<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Static analyzer false positive of Unix API violation: Improper use of 'open', when 'open is in an alternative namespace"
   href="https://llvm.org/bugs/show_bug.cgi?id=28331">28331</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Static analyzer false positive of Unix API violation: Improper use of 'open', when 'open is in an alternative namespace
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Static Analyzer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>kremenek@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>nega@icecube.umd.edu
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=16642" name="attach_16642" title="sample code demonstrating Unix API violation false positive">attachment 16642</a> <a href="attachment.cgi?id=16642&action=edit" title="sample code demonstrating Unix API violation false positive">[details]</a></span>
sample code demonstrating Unix API violation false positive

When the function open() appears in an alternative namespace with an unusual
number of arguments, the static analyzer still reports it as a violation of the
standard Unix function open().

This behavior occurs in checker-278:
clang version 3.8.0 (tags/checker/checker-278)
Target: x86_64-apple-darwin15.2.0

Apple Clang:
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.2.0

and Ubuntu 16.04 Clang:
clang version 3.8.0-2ubuntu3 (tags/RELEASE_380/final)
Target: x86_64-pc-linux-gnu

The attached code demonstrates this behavior with:
❯ clang++ --analyze main.cc        
main.cc:17:3: warning: Call to 'open' with more than three arguments
  outer::inner::open(ofs_, "foo");
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>