Skip to content

Commit 52fe7a4

Browse files
authored
Merge pull request #942 from corob-msft/cr-permissive-158
Updates for /permissive in 15.8
2 parents 188552f + 6e5f623 commit 52fe7a4

8 files changed

Lines changed: 518 additions & 460 deletions

docs/assembler/masm/masm-for-x64-ml64-exe.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "MASM for x64 (ml64.exe) | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "06/08/2018"
4+
ms.date: "06/21/2018"
55
ms.technology: ["cpp-masm"]
66
ms.topic: "reference"
77
dev_langs: ["C++"]
@@ -13,7 +13,7 @@ ms.workload: ["cplusplus"]
1313
---
1414
# MASM for x64 (ml64.exe)
1515

16-
Visual Studio includes both 32-bit and 64-bit hosted versions of Microsoft Assembler (MASM) to target x64 code. Named ml64.exe, this is the assembler that accepts x64 assembler language. The MASM command-line tools are installed when you choose a C++ workload during Visual Studio installation. The MASM tools are not available as a separate download. For instructions on how to download and install a copy of Visual Studio, see [Install Visual Studio](/visualstudio/install/install-visual-studio). If you do not want to install the complete Visual Studio IDE, but only want the command-line tools, download the [Build Tools for Visual Studio 2017](https://go.microsoft.com/fwlink/p/?linkid=840931).
16+
Visual Studio includes both 32-bit and 64-bit hosted versions of Microsoft Assembler (MASM) to target x64 code. Named ml64.exe, this is the assembler that accepts x64 assembler language. The MASM command-line tools are installed when you choose a C++ workload during Visual Studio installation. The MASM tools are not available as a separate download. For instructions on how to download and install a copy of Visual Studio, see [Install Visual Studio](/visualstudio/install/install-visual-studio). If you do not want to install the complete Visual Studio IDE, but only want the command-line tools, download the [Build Tools for Visual Studio 2017](https://go.microsoft.com/fwlink/p/?linkid=875721).
1717

1818
To use MASM to build code for x64 targets on the command line, you must use a developer command prompt for x64 targets, which sets the required path and other environment variables. For information on how to start a developer command prompt, see [Build C/C++ code on the command line](../../build/building-on-the-command-line.md).
1919

docs/build/building-on-the-command-line.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Build C/C++ Code on the Command Line | Microsoft Docs"
33
ms.custom: "conceptual"
4-
ms.date: "03/29/2018"
4+
ms.date: "06/21/2018"
55
ms.technology: ["cpp-tools"]
66
ms.topic: "conceptual"
77
dev_langs: ["C++"]
@@ -37,7 +37,7 @@ The command prompt shortcuts are installed in a version-specific Visual Studio f
3737

3838
The actual Start menu folder and shortcut names vary depending on the version of Visual Studio you have installed, and the installation Nickname if you set one. For example, if you have Visual Studio 2017 installed, and you've given it an installation Nickname of *Preview*, the developer command prompt shortcut is named **Developer Command Prompt for VS 2017 (Preview)**, in a folder named **Visual Studio 2017**.
3939

40-
If you've installed the [Build Tools for Visual Studio 2017](https://go.microsoft.com/fwlink/p/?linkid=840931) (which also includes the Visual Studio 2015 Update 3 compiler toolset), only the architecture-specific native or cross tools developer command prompt options are installed, and not the general **Developer Command Prompt** shortcut.
40+
If you've installed the [Build Tools for Visual Studio 2017](https://go.microsoft.com/fwlink/p/?linkid=875721) (which also includes the Visual Studio 2015 Update 3 compiler toolset), only the architecture-specific native or cross tools developer command prompt options are installed, and not the general **Developer Command Prompt** shortcut.
4141

4242
<a name="developer_command_prompt"></a>
4343
### To open a developer command prompt window

docs/build/reference/permissive-standards-conformance.md

Lines changed: 103 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "-permissive- (Standards conformance) | Microsoft Docs"
3-
ms.date: "11/11/2016"
3+
ms.date: "06/21/2018"
44
ms.technology: ["cpp-tools"]
55
ms.topic: "reference"
66
f1_keywords: ["/permissive", "VC.Project.VCCLCompilerTool.ConformanceMode"]
@@ -35,7 +35,7 @@ Environment-specific extensions and language areas that the standard leaves up t
3535

3636
The **/permissive-** option uses the conformance support in the current compiler version to determine which language constructs are non-conforming. The option does not determine if your code conforms to a specific version of the C++ standard. To enable all implemented compiler support for the latest draft standard, use the [/std:latest](../../build/reference/std-specify-language-standard-version.md) option. To restrict the compiler support to the currently implemented C++17 standard, use the [/std:c++17](../../build/reference/std-specify-language-standard-version.md) option. To restrict the compiler support to more closely match the C++14 standard, use the [/std:c++14](../../build/reference/std-specify-language-standard-version.md) option, which is the default.
3737

38-
Not all C++11, C++14, or C++17 standards-conforming code is supported by the Visual C++ compiler in Visual Studio 2017. The **/permissive-** option may not detect issues regarding some aspects of two-phase name lookup, binding a non-const reference to a temporary, treating copy init as direct init, allowing multiple user-defined conversions in initialization, or alternative tokens for logical operators, and other non-supported conformance areas. For more information about conformance issues in Visual C++, see [Nonstandard Behavior](../../cpp/nonstandard-behavior.md).
38+
Not all C++11, C++14, or C++17 standards-conforming code is supported by the Visual C++ compiler in Visual Studio 2017. Depending on the version of Visual Studio, the **/permissive-** option may not detect issues regarding some aspects of two-phase name lookup, binding a non-const reference to a temporary, treating copy init as direct init, allowing multiple user-defined conversions in initialization, or alternative tokens for logical operators, and other non-supported conformance areas. For more information about conformance issues in Visual C++, see [Nonstandard Behavior](../../cpp/nonstandard-behavior.md). To get the most out of **/permissive-**, update Visual Studio to the latest version.
3939

4040
### How to fix your code
4141

@@ -187,11 +187,11 @@ class CFoo : public ICustom
187187

188188
```cpp
189189
// Fix for example 2
190-
// First, create the *.idl file. The vc140.idl generated file can be
191-
// used to automatically obtain a *.idl file for the interfaces with
192-
// annotation. Second, add a midl step to your build system to make
193-
// sure that the C++ interface definitions are outputted.
194-
// Last, adjust your existing code to use ATL directly as shown in
190+
// First, create the *.idl file. The vc140.idl generated file can be
191+
// used to automatically obtain a *.idl file for the interfaces with
192+
// annotation. Second, add a midl step to your build system to make
193+
// sure that the C++ interface definitions are outputted.
194+
// Last, adjust your existing code to use ATL directly as shown in
195195
// the atl implementation section.
196196

197197
-- IDL FILE--
@@ -271,7 +271,7 @@ struct MyString
271271

272272
extern bool cond;
273273

274-
MyString s;
274+
MyString s;
275275
// Using /std:c++14, /permissive- or /Zc:ternary behavior
276276
// is to prefer MyString("A") over (const char*)s
277277
// but under /std:c++17 this line causes error C2445:
@@ -294,23 +294,23 @@ void myassert(const char* text, const char* file, int line);
294294
You may also see errors in template metaprogramming, where conditional operator result types may change under **/Zc:ternary** and **/permissive-**. One way to resolve this issue is to use [std::remove_reference](../../standard-library/remove-reference-class.md) on the resulting type.
295295

296296
```cpp
297-
// Example 4: different result types
297+
// Example 4: different result types
298298
extern bool cond;
299299
extern int count;
300-
char a = 'A';
301-
const char b = 'B';
302-
decltype(auto) x = cond ? a : b; // char without, const char& with /Zc:ternary
303-
const char (&z)[2] = count > 3 ? "A" : "B"; // const char* without /Zc:ternary
300+
char a = 'A';
301+
const char b = 'B';
302+
decltype(auto) x = cond ? a : b; // char without, const char& with /Zc:ternary
303+
const char (&z)[2] = count > 3 ? "A" : "B"; // const char* without /Zc:ternary
304304
```
305305
306-
#### Two-phase name look up (partial)
306+
#### Two-phase name look up
307307
308-
When the **/permissive-** option is set in Visual Studio 2017 version 15.3, the compiler parses function and class template definitions, identifying dependent and non-dependent names used in templates as required for two-phase name look-up. In this release, only name dependency analysis is performed. In particular, non-dependent names that are not declared in the context of a template definition cause a diagnostic message as required by the ISO C++ standards. However, binding of non-dependent names that require argument dependent look up in the definition context is not done.
308+
When the **/permissive-** option is set, the compiler parses function and class template definitions, identifying dependent and non-dependent names used in templates as required for two-phase name look-up. In Visual Studio 2017 version 15.3, name dependency analysis is performed. In particular, non-dependent names that are not declared in the context of a template definition cause a diagnostic message as required by the ISO C++ standards. In Visual Studio 2017 version 15.7, binding of non-dependent names that require argument dependent look up in the definition context is also done.
309309
310310
```cpp
311311
// dependent base
312312
struct B {
313-
void g();
313+
void g() {}
314314
};
315315
316316
template<typename T>
@@ -331,68 +331,114 @@ int main()
331331
}
332332
```
333333

334+
If you want legacy behavior for two-phase lookup, but otherwise want **/permissive-** behavior, add the **/Zc:twoPhase-** option.
335+
334336
### Windows header issues
335337

336338
The **/permissive-** option is too strict for versions of the Windows Kits before Windows Fall Creators Update SDK (10.0.16299.0), or the Windows Driver Kit (WDK) version 1709. We recommend you update to the latest versions of the Windows Kits in order to use **/permissive-** in your Windows or device driver code.
337339

338-
Certain header files in the Windows Fall Creators Update SDK (10.0.16299.0), or the Windows Driver Kit (WDK) 1709, still have issues that make them incompatible with use of **/permissive-**. To work around these issues, we recommend you restrict the use of these headers to only those source code files that require them, and remove the **/permissive-** option when you compile those specific source code files. The following issues are specific to the Windows Fall Creators Update SDK (10.0.16299.0):
340+
Certain header files in the Windows April 2018 Update SDK (10.0.17134.0), the Windows Fall Creators Update SDK (10.0.16299.0), or the Windows Driver Kit (WDK) 1709, still have issues that make them incompatible with use of **/permissive-**. To work around these issues, we recommend you restrict the use of these headers to only those source code files that require them, and remove the **/permissive-** option when you compile those specific source code files.
339341

340-
#### Issue in um\Query.h
342+
These WinRT WRL headers released in the Windows April 2018 Update SDK (10.0.17134.0) are not clean with **/permissive-**. To work around these issues, either do not use **/permissive-**, or use **/permissive-** with **/Zc:twoPhase-** when working with these headers:
341343

342-
When using the **/permissive-** compiler switch, the `tagRESTRICTION` structure does not compile due to the case(RTOr) member 'or'.
344+
- Issues in winrt/wrl/async.h
343345

344-
```cpp
345-
struct tagRESTRICTION
346-
    {
347-
    ULONG rt;
348-
    ULONG weight;
349-
    /* [switch_is][switch_type] */ union _URes
350-
        {
351-
        /* [case()] */ NODERESTRICTION ar;
352-
        /* [case()] */ NODERESTRICTION or; // error C2059: syntax error: '||'
353-
        /* [case()] */ NODERESTRICTION pxr;
354-
        /* [case()] */ VECTORRESTRICTION vr;
355-
        /* [case()] */ NOTRESTRICTION nr;
356-
        /* [case()] */ CONTENTRESTRICTION cr;
357-
        /* [case()] */ NATLANGUAGERESTRICTION nlr;
358-
        /* [case()] */ PROPERTYRESTRICTION pr;
359-
        /* [default] */  /* Empty union arm */
360-
        } res;
361-
    };
362-
```
346+
```Output
347+
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\winrt\wrl\async.h(483): error C3861: 'TraceDelegateAssigned': identifier not found
348+
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\winrt\wrl\async.h(491): error C3861: 'CheckValidStateForDelegateCall': identifier not found
349+
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\winrt\wrl\async.h(509): error C3861: 'TraceProgressNotificationStart': identifier not found
350+
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\winrt\wrl\async.h(513): error C3861: 'TraceProgressNotificationComplete': identifier not found
351+
```
363352

364-
To address this issue, compile files that include Query.h without the **/permissive-** option.
353+
- Issue in winrt/wrl/implements.h
365354

366-
#### Issue in um\cellularapi_oem.h
355+
```Output
356+
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt\wrl\implements.h(2086): error C2039: 'SetStrongReference': is not a member of 'Microsoft::WRL::Details::WeakReferenceImpl'
357+
```
367358

368-
When using the **/permissive-** compiler switch, the forward declaration of `enum UICCDATASTOREACCESSMODE` causes a warning:
359+
These User Mode headers released in the Windows April 2018 Update SDK (10.0.17134.0) are not clean with **/permissive-**. To work around these issues, do not use **/permissive-** when working with these headers:
369360

370-
```cpp
371-
typedef enum UICCDATASTOREACCESSMODE UICCDATASTOREACCESSMODE; // C4471
372-
```
361+
- Issues in um/Tune.h
373362

374-
The forward declaration of unscoped enum is a Microsoft extension. To address this issue, compile files that include cellularapi_oem.h without the **/permissive-** option, or use the [/wd](../../build/reference/compiler-option-warning-level.md) option to silence warning C4471.
363+
```Output
364+
C:\ProgramFiles(x86)\Windows Kits\10\include\10.0.17134.0\um\tune.h(139): error C3861: 'Release': identifier not found
365+
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um\tune.h(559): error C3861: 'Release': identifier not found
366+
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um\tune.h(1240): error C3861: 'Release': identifier not found
367+
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um\tune.h(1240): note: 'Release': function declaration must be available as none of the arguments depend on a template parameter
368+
```
375369

376-
#### Issue in um\omscript.h
370+
- Issue in um/spddkhlp.h
377371

378-
In C++03, a conversion from a string literal to BSTR (which is a typedef to 'wchar_t *') is deprecated but allowed. In C++11, the conversion is no longer allowed.
372+
```Output
373+
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um\spddkhlp.h(759): error C3861: 'pNode': identifier not found
374+
```
379375

380-
```cpp
381-
virtual /* [id] */ HRESULT STDMETHODCALLTYPE setExpression(
382-
/* [in] */ __RPC__in BSTR propname,
383-
/* [in] */ __RPC__in BSTR expression,
384-
/* [in][defaultvalue] */ __RPC__in BSTR language = L"") = 0; // C2440
385-
```
376+
- Issues in um/refptrco.h
377+
378+
```Output
379+
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um\refptrco.h(179): error C2760: syntax error: unexpected token 'identifier', expected 'type specifier'
380+
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um\refptrco.h(342): error C2760: syntax error: unexpected token 'identifier', expected 'type specifier'
381+
C:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um\refptrco.h(395): error C2760: syntax error: unexpected token 'identifier', expected 'type specifier'
382+
```
383+
384+
These issues are specific to User Mode headers in the Windows Fall Creators Update SDK (10.0.16299.0):
385+
386+
- Issue in um/Query.h
387+
388+
When using the **/permissive-** compiler switch, the `tagRESTRICTION` structure does not compile due to the case(RTOr) member 'or'.
389+
390+
```cpp
391+
struct tagRESTRICTION
392+
{
393+
ULONG rt;
394+
ULONG weight;
395+
/* [switch_is][switch_type] */ union _URes
396+
{
397+
/* [case()] */ NODERESTRICTION ar;
398+
/* [case()] */ NODERESTRICTION or; // error C2059: syntax error: '||'
399+
/* [case()] */ NODERESTRICTION pxr;
400+
/* [case()] */ VECTORRESTRICTION vr;
401+
/* [case()] */ NOTRESTRICTION nr;
402+
/* [case()] */ CONTENTRESTRICTION cr;
403+
/* [case()] */ NATLANGUAGERESTRICTION nlr;
404+
/* [case()] */ PROPERTYRESTRICTION pr;
405+
/* [default] */ /* Empty union arm */
406+
} res;
407+
};
408+
```
409+
410+
To address this issue, compile files that include Query.h without the **/permissive-** option.
411+
412+
- Issue in um/cellularapi_oem.h
413+
414+
When using the **/permissive-** compiler switch, the forward declaration of `enum UICCDATASTOREACCESSMODE` causes a warning:
415+
416+
```cpp
417+
typedef enum UICCDATASTOREACCESSMODE UICCDATASTOREACCESSMODE; // C4471
418+
```
419+
420+
The forward declaration of unscoped enum is a Microsoft extension. To address this issue, compile files that include cellularapi_oem.h without the **/permissive-** option, or use the [/wd](../../build/reference/compiler-option-warning-level.md) option to silence warning C4471.
421+
422+
- Issue in um/omscript.h
423+
424+
In C++03, a conversion from a string literal to BSTR (which is a typedef to 'wchar_t *') is deprecated but allowed. In C++11, the conversion is no longer allowed.
425+
426+
```cpp
427+
virtual /* [id] */ HRESULT STDMETHODCALLTYPE setExpression(
428+
/* [in] */ __RPC__in BSTR propname,
429+
/* [in] */ __RPC__in BSTR expression,
430+
/* [in][defaultvalue] */ __RPC__in BSTR language = L"") = 0; // C2440
431+
```
386432
387-
To address this issue, compile files that include omscript.h without the **/permissive-** option, or use **/Zc:strictStrings-** instead.
433+
To address this issue, compile files that include omscript.h without the **/permissive-** option, or use **/Zc:strictStrings-** instead.
388434
389435
### To set this compiler option in the Visual Studio development environment
390436
391437
In Visual Studio 2017 version 15.5 and later versions, use this procedure:
392438
393439
1. Open your project's **Property Pages** dialog box.
394440
395-
1. Under **Configuration Properties**, expand the **C/C++** folder and choose the **Language** property page.
441+
1. Select the **Configuration Properties** > **C/C++** > **Language** property page.
396442
397443
1. Change the **Conformance mode** property value to **Yes (/permissive-)**. Choose **OK** or **Apply** to save your changes.
398444
@@ -410,5 +456,5 @@ In versions before Visual Studio 2017 version 15.5, use this procedure:
410456
411457
## See also
412458
413-
[Compiler Options](../../build/reference/compiler-options.md)
414-
[Setting Compiler Options](../../build/reference/setting-compiler-options.md)
459+
- [Compiler Options](../../build/reference/compiler-options.md)
460+
- [Setting Compiler Options](../../build/reference/setting-compiler-options.md)

0 commit comments

Comments
 (0)