Thread overview
How to turn off warnings as errors
May 22

Hi GDC

I'm testing the new gdc version 12.1 by compiling vibe.d and various other packages. One problem that tripping me up when running commands like:

cd memutils
dub build --compiler=gdc-12

is that all deprecation warnings are treated as errors. (For my local build of gdc, '-12' has been added as a program suffix.)

Most of the messages are similar to the following:

source/memutils/rbtree.d:734:9: error: Usage of the ‘body’ keyword is deprecated. Use ‘do’ instead. [-Werror=deprecated]

These are dub packages and I don't see how to set '-Wno-error' from the dub command line. Since I'm reluctant to change every dub.json file that I encounter, is there a global flag that will turn off -Werror for gdc?

Thanks for the advice (and thanks for gdc),

May 22
On 22/05/2022 2:56 PM, Chris Piker wrote:
> These are dub packages and I don't see how to set '-Wno-error' from the dub command line. Since I'm reluctant to change every dub.json file that I encounter, is there a global flag that will turn off -Werror for gdc?

This is a dub issue, it has nothing to do with the compiler.

$ DFLAGS="..." dub ...

However if you hit these issues, its because there is a problem with that package.

In the case with memutils, it hasn't even got a working CI right now.
Nor is this the only issue it has that would mean it won't compile[0].

[0] https://github.com/etcimon/memutils/issues/19
May 22

On Sunday, 22 May 2022 at 03:02:17 UTC, rikki cattermole wrote:

>

This is a dub issue, it has nothing to do with the compiler.

Yea, there seem to be lots of dub issues, just looking for a workaround, hoping compiler features might save the day.

>

$ DFLAGS="..." dub ...

Thanks! This seems to work well for vibe-core 1.22.3 anyway:

cd vibe-core
dub build --compiler=dmd  # works
env DFLAGS="-Wno-deprecated" dub build --compiler=gdc-12 # also works

As a general bit of dev-culture advice, would you recommend that I file issues on packages that only build using -Wno-deprecated ?

Also, is there a way to compile gdc itself such that it's behavior is closer to dmd's when it comes to deprecated features? The --disable-werror configure flag looks like it only affects behavior while building the compiler itself.

May 22
On 22/05/2022 3:42 PM, Chris Piker wrote:
> As a general bit of dev-culture advice, would you recommend that I file issues on packages that only build using `-Wno-deprecated` ?

You can do that, but usually the reason it is like that is because nobody has worked on the project in a while and you could be waiting forever more if you don't file a PR for it.

> Also, is there a way to compile gdc itself such that it's behavior is closer to dmd's when it comes to deprecated features?  The `--disable-werror` configure flag looks like it only affects behavior while building the compiler itself.

Dub adds the flag for warnings as errors. Its not a bug, that is a feature. This applies for all compilers.
May 23
Excerpts from rikki cattermole via D.gnu's message of Mai 22, 2022 7:18 am:
> 
> On 22/05/2022 3:42 PM, Chris Piker wrote:
>> As a general bit of dev-culture advice, would you recommend that I file issues on packages that only build using `-Wno-deprecated` ?
> 
> You can do that, but usually the reason it is like that is because nobody has worked on the project in a while and you could be waiting forever more if you don't file a PR for it.
> 
>> Also, is there a way to compile gdc itself such that it's behavior is closer to dmd's when it comes to deprecated features?  The `--disable-werror` configure flag looks like it only affects behavior while building the compiler itself.
> 
> Dub adds the flag for warnings as errors. Its not a bug, that is a feature. This applies for all compilers.
> 

It looks like this is correct as per the documentation of dub.

https://github.com/dlang/dub/wiki/DEP1#build-requirements

You either have disallowDeprecations or silenceDeprecations.  There is no build option for allowing deprecations.

Iain.