1. IT-Security >
  2. Programmierung >
  3. Announcing full support for a C/C++ conformant preprocessor in MSVC

ArabicEnglishFrenchGermanGreekItalianJapaneseKoreanPersianPolishPortugueseRussianSpanishTurkishVietnamese

Announcing full support for a C/C++ conformant preprocessor in MSVC


Programmierung vom | Direktlink: devblogs.microsoft.com Nachrichten Bewertung

We are excited to announce full support for a conformant preprocessor in the MSVC toolset starting with Visual Studio 2019 version 16.6 Preview 2.

Since the original blog post announcing preprocessor conformance changes, we’ve come a long way and are now ready to announce the completion of the C/C++ conformant preprocessor and its move to a non-experimental, fully supported state via the /Zc:preprocessor switch. Alongside standard conformance, the preprocessor also supports C++20’s __VA_OPT__ and is also available in the C language mode.

What’s new:

To reach conformance, a couple of additional features have been added to the preprocessor and MSVC compiler, including a variety of bug fixes, __VA_OPT__, and _Pragma support.

Bugfixes involving various parts of the preprocessor, from parameter expansion and special macro names like __FUNCSIG__ to reporting arity errors and line number fixes. Special thanks to Edward Diener for providing a lot of valuable feedback!

__VA_OPT__

__VA_OPT__ is a new feature of variadic macros in C++20. It lets you optionally insert tokens depending on if a variadic macro is invoked with additional arguments. An example usage is comma elision in a standardized manner.

#define M(X, …) X __VA_OPT__(,) __VA_ARGS__
M(3) // expands to 3
M(3, 4) // expands to 3, 4

_Pragma

The _Pragma operator has been one of the long-standing deficiencies of the preprocessor, and a blocker in being standard conformant in C++ and C99. Though MSVC had the non-conformant __pragma, the semantics differ in that _Pragma takes a string literal as its parameter instead of a series of preprocessor tokens. This feature is now implemented.

_Pragma(“once”)
#define GUARD _Pragma(“once”)

Miscellaneous

There were some contextual keyword changes relating to modules. These changes unblock further C++20 modules work.

Preprocessor-only output (via /E and /P) is now prettier, reducing the amount of line directives and fixing some formatting issues.

Enabling the conformant preprocessor in your environment

All that is needed to use the conformant preprocessor is to add /Zc:preprocessor to your compilation flags. The flag is available in C and C++ language modes. It works with any language level, but we plan to enable it for /std:c++latest in a future release.

Language mode /Zc:preprocessor
/std:c++14 Not implied
/std:c++17 Not implied
/std:c++latest Implied in a future update (Not implied in VS 2019 v16.6)

The conformant preprocessor can be tested by checking if the macro _MSVC_TRADITIONAL is defined and set to 0.

#if defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL
// old behavior
#else
// new behavior
#endif

The legacy preprocessor is not going anywhere, it will continue to serve as a compatibility layer for old code, but it will only be serviced with the intention of keeping old code working. Additionally, the /experimental:preprocessor switch is still available and will activate /Zc:preprocessor in VS 2019 v16.6 but will be removed in a future release. Any projects that have been configured to use the experimental switch should migrate to the supported version.

What’s next:

Improved diagnostics are in the works, which will provide a better expansion context for macro invocation and errors.

This feature is not currently implied by any other flags, but we are planning to include it in /std:c++latest once we stabilize the public SDK headers from using non-conformant macros. Using the latest Windows SDK is advised, as many of the noisy warnings are fixed in later SDK versions.

Call to Action

Let us know how the conformant preprocessor works for you! Get it in Visual Studio 2019 version 16.6 Preview 2 (please see https://visualstudio.microsoft.com/vs/preview/ for download links) and try it out.

As always, we welcome your feedback. We can be reached via the comments below or via email ([email protected]). If you encounter problems with Visual Studio or MSVC, or have a suggestion for us, please let us know through Help > Send Feedback > Report A Problem / Provide a Suggestion in the product, or via Developer Community. You can also find us on Twitter (@VisualC).

The post Announcing full support for a C/C++ conformant preprocessor in MSVC appeared first on C++ Team Blog.

...

Externe Webseite mit kompletten Inhalt öffnen



https://devblogs.microsoft.com/cppblog/announcing-full-support-for-a-c-c-conformant-preprocessor-in-msvc/

Team Security Social Media

➤ Weitere Beiträge von Team Security | IT Sicherheit

  • Announcing full support for a C/C++ conformant preprocessor in MSVC

    vom 940.67 Punkte ic_school_black_18dp
    We are excited to announce full support for a conformant preprocessor in the MSVC toolset starting with Visual Studio 2019 version 16.6 Preview 2. Since the original blog post announcing preprocessor conformance changes, we’ve come a long way and are now ready to announce th
  • Side-by-side Minor Version MSVC Toolsets in Visual Studio 2019

    vom 341.83 Punkte ic_school_black_18dp
    Visual Studio 2019 version 16.1 Preview 3 ships with the first side-by-side minor versions of the v142 MSVC toolset. We first shipped minor side-by-side versions of MSVC toolsets with Visual Studio 2017, but a few things have changed in 2019. This post c
  • Movierulz 2020 | Download Watch Telugu Bollywood and Hollywood Full Movies Online Free

    vom 306.2 Punkte ic_school_black_18dp
    Movierulz - Download watch latest Bollywood Hollywood Hindi English Telugu Tamil Malayalam Dubbed Kannada Marathi Punjabi movies online free movierulz torrent8Movierulz.ws- Download Watch Telugu Bollywood and Hollywood Full Movies Online FreeThe torre
  • Better template support and error detection in C++ Modules with MSVC 2017 version 15.9

    vom 271 Punkte ic_school_black_18dp
    Overview It has been a long time since we last talked about C++ Modules. We feel it is time to revisit what has been happening under the hood of MSVC for modules. The Visual C++ Team has been dedicated to pushing conformance to the standard 
  • Better template support and error detection in C++ Modules with MSVC 2017 version 15.9

    vom 271 Punkte ic_school_black_18dp
    Overview It has been a long time since we last talked about C++ Modules. We feel it is time to revisit what has been happening under the hood of MSVC for modules. The Visual C++ Team has been dedicated to pushing conformance to the standard 
  • Open Sourcing MSVC’s STL

    vom 242.16 Punkte ic_school_black_18dp
    Today at CppCon 2019, we (the MSVC team) announced that we’re releasing our implementation of the C++ Standard Library (also known as the STL) as open source. https://github.com/microsoft/STL is our new repository, containing all of our product sou
  • Donut - Generates X86, X64, Or AMD64+x86 Position-Independent Shellcode That Loads .NET Assemblies, PE Files, And Other Windows Payloads From Memory

    vom 195.94 Punkte ic_school_black_18dp
    Donut generates x86 or x64 shellcode from VBScript, JScript, EXE, DLL (including .NET Assemblies) files. This shellcode can be injected into an arbitrary Windows processes for in-memory execution. Given a supported file type, parameters and an entry point where
  • AddressSanitizer (ASan) for Windows with MSVC

    vom 189.74 Punkte ic_school_black_18dp
    We are pleased to announce AddressSanitizer (ASan) support for the MSVC toolset. ASan is a fast memory error detector that can find runtime memory issues such as use-after-free and perform out of bounds checks. Support for sanitizers has been one of ou
  • ‘Tis the Season for the Visual Studio 2019 v16.4 Release

    vom 167.6 Punkte ic_school_black_18dp
    Giving Tree on Microsoft CampusHere in Redmond, glimpses of holiday cheer are filling our campus buildings as the season shifts to twinkling lights and frosty temperatures.  The Visual Studio team is seizing this time as an opportunity to celebrate the comradery
  • JCC Erratum Mitigation in MSVC

    vom 159.54 Punkte ic_school_black_18dp
    The content of this blog was provided by Gautham Beeraka from Intel Corporation. Intel recently announced Jump Conditional Code (JCC) Erratum which can occur in some of its processors. The MSVC team has been working with Intel to provide a software fix
  • Announcing .NET Core 3.0

    vom 135.73 Punkte ic_school_black_18dp
    Announcing .NET Core 3.0 We’re excited to announce the release of .NET Core 3.0. It includes many improvements, including adding Windows Forms and WPF, adding new JSON APIs, support for ARM64 and improving performance across the board. C# 8 is als
  • .NET Framework July 2019 Security and Quality Rollup

    vom 128.54 Punkte ic_school_black_18dp
    Today, we are releasing the July 2019 Cumulative Update, Security and Quality Rollup, and Security Only Update for .NET Framework. Security CVE-2019-1006 – WCF/WIF SAML Token Authentication Bypass Vulnerability An authentication bypass vulnerability exists in Windows Communication Foundation (WCF) and Windows Identity Foundation

Team Security Diskussion über Announcing full support for a C/C++ conformant preprocessor in MSVC