Skip to content

Commit 652ab07

Browse files
authored
Add "Remarks" and "Example" headings for warning references in range [C4751, C4830]
1 parent a3f18e6 commit 652ab07

28 files changed

+84
-8
lines changed

docs/error-messages/compiler-warnings/c4768.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ helpviewer_keywords: ["C4768"]
99

1010
> `__declspec` attributes before linkage specification are ignored
1111
12-
The compiler warns if `__declspec(...)` is applied before the `extern "C"` linkage specification. Previously, the compiler would ignore the attribute, which could have runtime implications.
13-
1412
## Remarks
1513

14+
The compiler warns if `__declspec(...)` is applied before the `extern "C"` linkage specification. Previously, the compiler would ignore the attribute, which could have runtime implications.
15+
1616
This warning is new in Visual Studio 2017 version 15.3, which left it off by default. It's enabled by default as a level 3 warning starting in Visual Studio 2017 version 15.5. For information on how to disable warnings by compiler version, see [Compiler warnings by compiler version](compiler-warnings-by-compiler-version.md).
1717

1818
## Example

docs/error-messages/compiler-warnings/c4770.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ helpviewer_keywords: ["C4770"]
99

1010
> partially validated enum '*symbol*' used as index
1111
12-
The compiler warns if an enum value is cast or aliased to an integer type, but the result isn't checked for non-negative or excessive values.
13-
1412
## Remarks
1513

14+
The compiler warns if an enum value is cast or aliased to an integer type, but the result isn't checked for non-negative or excessive values.
15+
1616
This warning is new in Visual Studio 2013. It's not enabled by default. To enable it as a level 1 warning, use `/w14770`. For information on how to disable warnings by compiler version, see [Compiler warnings by compiler version](compiler-warnings-by-compiler-version.md).
1717

1818
## Example

docs/error-messages/compiler-warnings/compiler-warning-level-1-and-3-c4793.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The following table lists all possible continuation messages.
3030
|A non-__clrcall virtual function thunk must be compiled as native|A non-[__clrcall](../../cpp/clrcall.md) virtual function thunk must use an unmanaged address.|
3131
|A function using '_setjmp' must be compiled as native|The CLR must be able to control program execution. However, the [setjmp](../../cpp/using-setjmp-longjmp.md) function bypasses regular program execution by saving and restoring low-level information such as registers and execution state.|
3232

33-
## Example
33+
## Examples
3434

3535
The following sample generates C4793.
3636

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4772.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ ms.assetid: dafe6fd8-9faf-41f5-9d66-a55838742c14
1010

1111
> #import referenced a type from a missing type library; '*missing-type*' used as a placeholder
1212
13+
## Remarks
14+
1315
A type library was referenced with the [#import](../../preprocessor/hash-import-directive-cpp.md) directive. However, the type library contained a reference to another type library that was not referenced with `#import`. This other .tlb file was not found by the compiler.
1416

1517
Note that the compiler will not find type libraries in different directories if you use the [/I (Additional Include Directories)](../../build/reference/i-additional-include-directories.md) compiler option to specify those directories. If you want the compiler to find type libraries in different directories, add those directories to the PATH environment variable.

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4788.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,17 @@ ms.assetid: 47d75bda-f833-4bdd-93a0-a134df0cd303
1010

1111
> 'identifier' : identifier was truncated to 'number' characters
1212
13+
## Remarks
14+
1315
The compiler limits the maximum length allowed for a function name. When the compiler generates funclets for EH/SEH code, it forms the funclet name by prepending the function name with some text, for example "__catch", "\__unwind", or another string.
1416

1517
The resulting funclet name can be too long, and the compiler will truncate it and generate C4788.
1618

17-
To resolve this warning, shorten the original function name. If the function is a C++ function template or method, use a typedef for part of the name. For example:
19+
To resolve this warning, shorten the original function name. If the function is a C++ function template or method, use a typedef for part of the name.
20+
21+
## Example
22+
23+
For example:
1824

1925
```cpp
2026
C1<x, y, z<T>>::C2<a,b,c>::f

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4794.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ ms.assetid: badc9c36-fa1a-4fec-929b-7bfda7a7b79f
1010

1111
> segment of thread local storage variable 'variable' changed from 'section name' to '.tls$'
1212
13+
## Remarks
14+
1315
You used [#pragma data_seg](../../preprocessor/data-seg.md) to put a tls variable in a section not starting with .tls$.
1416

1517
The .tls$*x* section will exist in the object file where [__declspec(thread)](../../cpp/thread.md) variables are defined. A .tls section in the EXE or DLL will result from these sections.

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4799.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ helpviewer_keywords: ["C4799"]
99

1010
> function '*function*' has no EMMS instruction
1111
12+
## Remarks
13+
1214
The function has at least one MMX instruction, but does not have an `EMMS` instruction. When a multimedia instruction is used, an `EMMS` instruction or [`_mm_empty`](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_empty) intrinsic should also be used to clear the multimedia tag word at the end of the MMX code.
1315

1416
You may get C4799 when using `ivec.h`, indicating that the code does not properly execute the `EMMS` instruction before returning. This is a false warning for these headers. You may turn these off by defining `_SILENCE_IVEC_C4799` in `ivec.h`. However, be aware that this will also keep the compiler from giving correct warnings of this type.

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4803.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ ms.assetid: 2552f3a6-c418-49f4-98a2-a929857be658
1010

1111
> 'method' : the raise method has a different storage class from that of the event, 'event'
1212
13+
## Remarks
14+
1315
Event methods must have the same storage class as the event declaration. The compiler adjusts the event's methods so that the storage classes are the same.
1416

1517
This warning can occur if you have a class that implements an event from an interface. The compiler does not implicitly generate a raise method for an event in an interface. When you implement that interface in a class, the compiler does implicitly generate a raise method and that method will not be virtual, hence the warning. For more information on events, see [event](../../extensions/event-cpp-component-extensions.md).

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4804.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ ms.assetid: 069e8f44-3ef6-43bb-8524-4116fc6eea83
1010

1111
> 'operation' : unsafe use of type 'bool' in operation
1212
13+
## Remarks
14+
1315
This warning is for when you used a **`bool`** variable or value in an unexpected way. For example, C4804 is generated if you use operators such as the negative unary operator (**-**) or the complement operator (`~`). The compiler evaluates the expression.
1416

1517
## Example

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4805.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ ms.assetid: 99c7b7e2-272e-4ab5-8580-17c42e62e2ef
1010

1111
> 'operation' : unsafe mix of type 'type' and type 'type' in operation
1212
13-
This warning is generated for comparison operations between [bool](../../cpp/bool-cpp.md) and [int](../../c-language/integer-types.md). The following sample generates C4805:
13+
## Remarks
14+
15+
This warning is generated for comparison operations between [bool](../../cpp/bool-cpp.md) and [int](../../c-language/integer-types.md).
16+
17+
## Example
18+
19+
The following sample generates C4805:
1420

1521
```cpp
1622
// C4805.cpp

0 commit comments

Comments
 (0)