Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: fb2k SDK problem: C++ compliance in headers (Read 3875 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

fb2k SDK problem: C++ compliance in headers

Some PFC headers fail to compile with `/permissive-` flag (C++ standard conformance):
Code: [Select]
pfc\list.h(236,1): error C2664:  'void pfc::list_base_t<T>::sort(void)': cannot convert argument 1 from 'pfc::list_base_t<T>::sort_callback_impl_t<t_compare>' to 'pfc::list_base_t<T>::sort_callback &'
This is caused by passing temporary variable to a method that accepts only non-const reference argument, which is prohibited by C++ standard.

Since this header is included (transitively) in the components that uses PFC, it prevents such components to be built in C++ conformance mode (which is required for some other libraries like `range-v3`)

Possible fix implementation: https://github.com/TheQwertiest/pfc/commit/1610e1ac450d9d1c16a139afe73c8743b12f4ac8


Re: fb2k SDK problem: C++ compliance in headers

Reply #2
Other C++ conformance issues: https://github.com/TheQwertiest/foobar2000-sdk/commit/966c454c23a6cd91d8689fd68a48799a3949be7e

Another temporary passed as non-const reference argument + ambiguous call in template method (doesn't work with two-phase name lookup).

 

Re: fb2k SDK problem: C++ compliance in headers

Reply #3
Noted, thanks for reporting.

... not like the SDK is really meant to work on anything else but MSVC and these are typical MSVC-isms, but they will be addressed anyway.
Microsoft Windows: We can't script here, this is bat country.

Re: fb2k SDK problem: C++ compliance in headers

Reply #4
... not like the SDK is really meant to work on anything else but MSVC and these are typical MSVC-isms
Well, MS have been working pretty hard last few years on making MSVC C++ conformant. This work resulted in the following flags (among other things): `/permissive-` (which is now on by default in new projects), `/experimental:preprocessor`,  `/experimental:newLambdaProcessor` (both of which are planned to be on by default, once all the kinks are ironed out). Some of these are required by popular cross-platform C++ libraries, since they are relying on correct C++ behaviour.

Re: fb2k SDK problem: C++ compliance in headers

Reply #5
Please keep in mind that foobar2000 still supports Windows XP.

Whether to support XP in your component is up to you, but if you do, your Platform SDK won't compile with /permissive- anyway.

I'm working in ironing all these out for the next update.
Microsoft Windows: We can't script here, this is bat country.

Re: fb2k SDK problem: C++ compliance in headers

Reply #6
@Peter :
Another compliance issue that I've encountered (after updating to VS 2019 16.4 Preview 2.0):
`Use of the class in a template before it's declaration`.

Repro steps:
- Download latest fb2k SDK.
- Open it in VS specified above.
- Change all projects to use v142 compiler.
- Enable C++14 and enforce C++ compliance in `foo_sample` (C++ > Language > Conformance mode > Yes; C++ > Language > C++ Language Standard > C++14).
- Compile the project.

Error output:
Code: [Select]
Error C3861: 'service_factory_base': identifier not found; foo_sample: foobar2000\SDK\service.h: 458

This is easily fixed by forward declaring `class service_factory_base` before (or inside) `service.h`.

Related MSVS issue (with link to explanation of this new behaviour): https://developercommunity.visualstudio.com/content/problem/782516/vs2019-1640-preview-2-problems-with-permissive-and.html

PS: Thanks for fixing all previously mentioned issues!

Re: fb2k SDK problem: C++ compliance in headers

Reply #7
VS 2019 16.4 was released, so the issue described above will be present on any CI that have updated their images.

Re: fb2k SDK problem: C++ compliance in headers

Reply #8
New SDK posted, /fpermissive- issues in service factory headers have been addressed.
Microsoft Windows: We can't script here, this is bat country.

Re: fb2k SDK problem: C++ compliance in headers

Reply #9
New SDK posted, /fpermissive- issues in service factory headers have been addressed.
Yup, everything compiles fine now, thanks!