Skip to content

Commit 7edade9

Browse files
author
Colin Robertson
authored
Merge pull request #3257 from MicrosoftDocs/master637620539308183571
Repo sync for protected CLA branch
2 parents f95bf06 + b75bd18 commit 7edade9

File tree

6 files changed

+420
-342
lines changed

6 files changed

+420
-342
lines changed

docs/build/launch-vs-schema-reference-cpp.md

Lines changed: 77 additions & 77 deletions
Large diffs are not rendered by default.

docs/build/reference/fp-specify-floating-point-behavior.md

Lines changed: 53 additions & 46 deletions
Large diffs are not rendered by default.

docs/c-runtime-library/reference/asctime-s-wasctime-s.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ The **asctime** function converts a time stored as a structure to a character st
8585

8686
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.
8787

88-
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.
88+
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.
8989

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

docs/c-runtime-library/reference/asctime-wasctime.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ The **asctime** function converts a time stored as a structure to a character st
5454

5555
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.
5656

57-
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.
57+
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.
5858

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

@@ -104,7 +104,7 @@ int main( void )
104104
```
105105
106106
```Output
107-
Current date and time: Sun Feb 03 11:38:58 2002
107+
Current date and time: Sun Feb 3 11:38:58 2002
108108
```
109109

110110
## See also

docs/preprocessor/system-header-pragma.md

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about the system_header pragma."
33
title: "system_header pragma"
4-
ms.date: 07/02/2021
4+
ms.date: 07/15/2021
55
f1_keywords: ["vc-pragma.system_header", "system_header_CPP", "system_header"]
66
helpviewer_keywords: ["pragma, system_header", "system_header pragma"]
77
no-loc: ["pragma"]
@@ -16,15 +16,55 @@ Treat the rest of the file as external for diagnostics reports.
1616
1717
## Remarks
1818

19-
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).
19+
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).
2020

21-
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.
21+
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):
2222

23-
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.
23+
```cpp
24+
// If n represents the warning level specified by /external:Wn,
25+
// #pragma system_header is roughly equivalent to:
26+
#pragma warning( push, n )
27+
28+
// . . .
29+
30+
// At the end of the file:
31+
#pragma warning( pop )
32+
```
2433

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

36+
## Example
37+
38+
This sample header shows how to mark the contents of a file as external:
39+
40+
```cpp
41+
// library.h
42+
// Use /external:Wn to set the compiler diagnostics level for this file's contents
43+
44+
#pragma once
45+
#ifndef _LIBRARY_H // include guard for 3rd party interop
46+
#define _LIBRARY_H
47+
#pragma system_header
48+
// The compiler applies the /external:Wn diagnostic level from here to the end of this file.
49+
50+
// . . .
51+
52+
// You can still override the external diagnostic level for warnings locally:
53+
#pragma warning( push )
54+
#pragma warning( error : 4164 )
55+
56+
// . . .
57+
58+
#pragma warning(pop)
59+
60+
// . . .
61+
62+
#endif
63+
```
64+
2765
## See also
2866

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

0 commit comments

Comments
 (0)