Skip to content

Prettify STL error output#2897

Merged
StephanTLavavej merged 9 commits intomicrosoft:mainfrom
strega-nil:better-error-message
Aug 3, 2022
Merged

Prettify STL error output#2897
StephanTLavavej merged 9 commits intomicrosoft:mainfrom
strega-nil:better-error-message

Conversation

@strega-nil-ms
Copy link
Contributor

@strega-nil-ms strega-nil-ms commented Jul 22, 2022

Fixes #2896

Before:

PS ...\stl-tests> cl /Tc .\stl-warnings.cxx
Microsoft (R) C/C++ Optimizing Compiler Version 19.33.31517 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

stl-warnings.cxx
...\yvals_core.h(23): fatal error C1189: #error:  STL1003: Unexpected compiler, expected C++ compiler.

After

PS ...\stl-tests> cl /Tc .\stl-warnings.cxx
Microsoft (R) C/C++ Optimizing Compiler Version 19.33.31517 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

stl-warnings.cxx
...\yvals_core.h(432): error STL1003: Unexpected compiler, expected C++ compiler.
...\yvals_core.h(432): error C2338: static_assert failed: 'Error in C++ Standard Library usage.'

Before:

```
PS ...\stl-tests> cl /Tc .\stl-warnings.cxx
Microsoft (R) C/C++ Optimizing Compiler Version 19.33.31517 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

stl-warnings.cxx
...\yvals_core.h(23): fatal error C1189: #error:  STL1003: Unexpected compiler, expected C++ compiler.
```

After

```
PS ...\stl-tests> cl /Tc .\stl-warnings.cxx
Microsoft (R) C/C++ Optimizing Compiler Version 19.33.31517 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

stl-warnings.cxx
...\yvals_core.h(432): error STL1003: Unexpected compiler, expected C++ compiler.
...\yvals_core.h(432): error C2338: static_assert failed: 'Error in C++ Standard Library usage.'
```
@strega-nil-ms strega-nil-ms added enhancement Something can be improved decision needed We need to choose something before working on this labels Jul 22, 2022
@strega-nil-ms
Copy link
Contributor Author

Given that people generally seem happy with the idea of the changes, marking non-draft

@strega-nil-ms strega-nil-ms marked this pull request as ready for review July 26, 2022 00:37
@strega-nil-ms strega-nil-ms requested a review from a team as a code owner July 26, 2022 00:37
@strega-nil-ms strega-nil-ms removed the decision needed We need to choose something before working on this label Jul 26, 2022
@StephanTLavavej
Copy link
Member

Need to merge main in order to pick up #2061.

@strega-nil-ms strega-nil-ms force-pushed the better-error-message branch from 1407b29 to 43c77f7 Compare July 29, 2022 17:45
@StephanTLavavej
Copy link
Member

@strega-nil-ms @CaseyCarter I've pushed a correctness fix, message appearance fix, and completed workaround removal - please double-check 😸

@strega-nil-ms
Copy link
Contributor Author

Thanks @StephanTLavavej, looks good to me :)

@StephanTLavavej StephanTLavavej self-assigned this Aug 3, 2022
@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit 222a558 into microsoft:main Aug 3, 2022
@StephanTLavavej
Copy link
Member

Thanks for improving how these errors are displayed! ✨ 🎉 😺

strega-nil added a commit to strega-nil/stl that referenced this pull request Aug 6, 2022
Co-authored-by: Nicole Mazzuca <mazzucan@outlook.com>
Co-authored-by: Stephan T. Lavavej <stl@nuwen.net>
fsb4000 pushed a commit to fsb4000/STL that referenced this pull request Aug 13, 2022
Co-authored-by: Nicole Mazzuca <mazzucan@outlook.com>
Co-authored-by: Stephan T. Lavavej <stl@nuwen.net>
@strega-nil-ms strega-nil-ms deleted the better-error-message branch December 19, 2022 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Something can be improved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Should STL errors use pragma message in order to make the output prettier/more obvious?

5 participants