Skip to content

Repo sync for protected CLA branch #3257

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

Merged
merged 12 commits into from
Jul 16, 2021
Merged
154 changes: 77 additions & 77 deletions docs/build/launch-vs-schema-reference-cpp.md

Large diffs are not rendered by default.

99 changes: 53 additions & 46 deletions docs/build/reference/fp-specify-floating-point-behavior.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/c-runtime-library/reference/asctime-s-wasctime-s.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ The **asctime** function converts a time stored as a structure to a character st

The converted character string is also adjusted according to the local time zone settings. See the [time, _time32, _time64](time-time32-time64.md), [_ftime, _ftime32, _ftime64](ftime-ftime32-ftime64.md), and [localtime_s, _localtime32_s, _localtime64_s](localtime-s-localtime32-s-localtime64-s.md) functions for information about configuring the local time and the [_tzset](tzset.md) function for information about defining the time zone environment and global variables.

The string result produced by **asctime_s** contains exactly 26 characters and has the form `Wed Jan 02 02:03:55 1980\n\0`. A 24-hour clock is used. All fields have a constant width. The new line character and the null character occupy the last two positions of the string. The value passed in as the second parameter should be at least this big. If it is less, an error code, **EINVAL**, will be returned.
The string result produced by **asctime_s** contains exactly 26 characters and has the form `Wed Jan 2 02:03:55 1980\n\0`. A 24-hour clock is used. All fields have a constant width. The new line character and the null character occupy the last two positions of the string. The value passed in as the second parameter should be at least this big. If it is less, an error code, **EINVAL**, will be returned.

**_wasctime_s** is a wide-character version of **asctime_s**. **_wasctime_s** and **asctime_s** behave identically otherwise.

Expand Down
4 changes: 2 additions & 2 deletions docs/c-runtime-library/reference/asctime-wasctime.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ The **asctime** function converts a time stored as a structure to a character st

The converted character string is also adjusted according to the local time zone settings. For information about configuring the local time, see the [time](time-time32-time64.md), [_ftime](ftime-ftime32-ftime64.md), and [localtime](localtime-localtime32-localtime64.md) functions and the [_tzset](tzset.md) function for information about defining the time zone environment and global variables.

The string result produced by **asctime** contains exactly 26 characters and has the form `Wed Jan 02 02:03:55 1980\n\0`. A 24-hour clock is used. All fields have a constant width. The newline character and the null character occupy the last two positions of the string. **asctime** uses a single, statically allocated buffer to hold the return string. Each call to this function destroys the result of the previous call.
The string result produced by **asctime** contains exactly 26 characters and has the form `Wed Jan 2 02:03:55 1980\n\0`. A 24-hour clock is used. All fields have a constant width. The newline character and the null character occupy the last two positions of the string. **asctime** uses a single, statically allocated buffer to hold the return string. Each call to this function destroys the result of the previous call.

**_wasctime** is a wide-character version of **asctime**. **_wasctime** and **asctime** behave identically otherwise.

Expand Down Expand Up @@ -104,7 +104,7 @@ int main( void )
```

```Output
Current date and time: Sun Feb 03 11:38:58 2002
Current date and time: Sun Feb 3 11:38:58 2002
```

## See also
Expand Down
50 changes: 45 additions & 5 deletions docs/preprocessor/system-header-pragma.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: "Learn more about the system_header pragma."
title: "system_header pragma"
ms.date: 07/02/2021
ms.date: 07/15/2021
f1_keywords: ["vc-pragma.system_header", "system_header_CPP", "system_header"]
helpviewer_keywords: ["pragma, system_header", "system_header pragma"]
no-loc: ["pragma"]
Expand All @@ -16,15 +16,55 @@ Treat the rest of the file as external for diagnostics reports.

## Remarks

Starting in Visual Studio 2017 version 15.6, the compiler lets you set two different default diagnostic warning levels on the command line. Normally, you use a [`/W0`, `/W1`, `/W2`, `/W3`, or `/W4`](../build/reference/compiler-option-warning-level.md) compiler option to specify a single diagnostic level for all code in a project. However, your project might include system header files or files from external libraries that generate warnings at the specified level. When you can't or don't want to edit these files, you can specify them as *external*. Files specified as external can have a separate compiler diagnostic level applied to them as a group. For more information on how to specify external files and the external warning level to the compiler, see [`/external`](../build/reference/external-external-headers-diagnostics.md).
The **`system_header`** pragma tells the compiler to show diagnostics at the level specified by the **`/external:Wn`** option for the rest of the current source file. For more information on how to specify external files and the external warning level to the compiler, see [`/external`](../build/reference/external-external-headers-diagnostics.md).

For example, a common scenario uses the **`/external:W1`** option to apply a **`/W1`** warning level to external library header files, while you use **`/W4 /WX`** on your own code. Then you don't see minor diagnostics for the code that isn't yours.
The **`system_header`** pragma doesn't apply past the end of the current source file. In other words, it doesn't apply to files that include this file. The **`system_header`** pragma applies even if no other files are specified as external to the compiler. However, if no **`/external:Wn`** option level is specified, the compiler may issue a diagnostic and uses the same [warning level](../build/reference/compiler-option-warning-level.md) it applies to non-external files. Other pragma directives that affect warning behavior still apply after a **`system_header`** pragma. The effect of `#pragma system_header` is similar to the [`warning pragma`](warning.md):

The **`system_header`** pragma tells the compiler to show diagnostics at the **`/external:Wn`** level for the rest of the source file. The **`system_header`** pragma applies even if no other files are specified as external to the compiler. However, if no **`/external:Wn`** option level is specified, the compiler issues a diagnostic and uses the same warning level it applies to non-external files. Other pragma directives that affect warning behavior still apply after a **`system_header`** pragma.
```cpp
// If n represents the warning level specified by /external:Wn,
// #pragma system_header is roughly equivalent to:
#pragma warning( push, n )

// . . .

// At the end of the file:
#pragma warning( pop )
```

The **`system_header`** pragma is available starting in Visual Studio 2019 version 16.10.

## Example

This sample header shows how to mark the contents of a file as external:

```cpp
// library.h
// Use /external:Wn to set the compiler diagnostics level for this file's contents

#pragma once
#ifndef _LIBRARY_H // include guard for 3rd party interop
#define _LIBRARY_H
#pragma system_header
// The compiler applies the /external:Wn diagnostic level from here to the end of this file.

// . . .

// You can still override the external diagnostic level for warnings locally:
#pragma warning( push )
#pragma warning( error : 4164 )

// . . .

#pragma warning(pop)

// . . .

#endif
```

## See also

[`/external`](../build/reference/external-external-headers-diagnostics.md)
[`/external`](../build/reference/external-external-headers-diagnostics.md)\
[`warning pragma`](warning.md)\
[`/Wn` (Compiler warning level)](../build/reference/compiler-option-warning-level.md)\
[Pragma directives and the `__pragma` and `_Pragma` keywords](./pragma-directives-and-the-pragma-keyword.md)
Loading