Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests using /analyze:only should also use /analyze:autolog- #1416

Closed
StephanTLavavej opened this issue Nov 3, 2020 · 0 comments · Fixed by #1434
Closed

Tests using /analyze:only should also use /analyze:autolog- #1416

StephanTLavavej opened this issue Nov 3, 2020 · 0 comments · Fixed by #1434
Labels
fixed Something works now, yay! test Related to test code

Comments

@StephanTLavavej
Copy link
Member

Several of our test configurations compile with /analyze:only. This emits a .nativecodeanalysis.xml file that we're never ever interested in. There's a (new?) compiler option to suppress this, /analyze:autolog-, which can be used with /analyze:only. Example:

C:\Temp>type meow.cpp && echo --- && dir /b meow.* && echo ---
#include <iostream>
using namespace std;

int f(int x, int y) {
    if (!x & y) {
        return 1;
    }
    return 0;
}

int main() {
    cout << "Hello, world!" << endl;
}
---
meow.cpp
---

C:\Temp>cl /EHsc /nologo /W4 /analyze meow.cpp && echo --- && dir /b meow.* && echo --- && del meow.exe meow.nativecodeanalysis.xml meow.obj
meow.cpp
C:\Temp\meow.cpp(5) : warning C6290: Bitwise operation on logical result:  ! has higher precedence than &.  Use && or (!(x & y)) instead.
---
meow.cpp
meow.exe
meow.nativecodeanalysis.xml
meow.obj
---

C:\Temp>cl /EHsc /nologo /W4 /analyze:autolog- meow.cpp && echo --- && dir /b meow.* && echo --- && del meow.exe meow.nativecodeanalysis.xml meow.obj
meow.cpp
C:\Temp\meow.cpp(5) : warning C6290: Bitwise operation on logical result:  ! has higher precedence than &.  Use && or (!(x & y)) instead.
---
meow.cpp
meow.exe
meow.obj
---

C:\Temp>cl /EHsc /nologo /W4 /analyze:only meow.cpp && echo --- && dir /b meow.* && echo --- && del meow.exe meow.nativecodeanalysis.xml meow.obj
meow.cpp
C:\Temp\meow.cpp(5) : warning C6290: Bitwise operation on logical result:  ! has higher precedence than &.  Use && or (!(x & y)) instead.
---
meow.cpp
meow.nativecodeanalysis.xml
---

C:\Temp>cl /EHsc /nologo /W4 /analyze:only /analyze:autolog- meow.cpp && echo --- && dir /b meow.* && echo ---
meow.cpp
C:\Temp\meow.cpp(5) : warning C6290: Bitwise operation on logical result:  ! has higher precedence than &.  Use && or (!(x & y)) instead.
---
meow.cpp
---

In #1394, I've pushed a commit to change plain /analyze to /analyze:autolog-. We should follow this up with another PR to change /analyze:only to /analyze:only /analyze:autolog-.

Aside: /analyze:only skips codegen, so we've generally paired it with a non-/analyze configuration, e.g.

PM_CL="/EHsc /MT /D_ITERATOR_DEBUG_LEVEL=0 /std:c++latest /permissive- /w14640 /Zc:threadSafeInit-"
PM_CL="/EHsc /MT /D_ITERATOR_DEBUG_LEVEL=0 /std:c++latest /permissive- /analyze:only /w14640 /Zc:threadSafeInit-"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed Something works now, yay! test Related to test code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant