Skip to content

Commit

Permalink
work around ubuntu 20.10 build issue
Browse files Browse the repository at this point in the history
NetHack was trying to suppress warn_unused_result
in include/tradstdc.h, by defining warn_unused_result
to an empty string. That began causing a build error
in a system-supplied header file cdefs.h
when using 20.10 ubuntu impish.

Try skipping that in tradstdc.h for any linux, unless
the NetHack build defines GCC_URWARN to force it into
play.
  • Loading branch information
nhmall committed Jan 4, 2022
1 parent c54c857 commit 1cb5dc0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/tradstdc.h
Expand Up @@ -405,12 +405,14 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */
#if __GNUC__ >= 3
#define UNUSED __attribute__((unused))
#define NORETURN __attribute__((noreturn))
#if !defined(__linux__) || defined(GCC_URWARN)
/* disable gcc's __attribute__((__warn_unused_result__)) since explicitly
discarding the result by casting to (void) is not accepted as a 'use' */
#define __warn_unused_result__ /*empty*/
#define warn_unused_result /*empty*/
#endif
#endif
#endif

#ifndef PRINTF_F
#define PRINTF_F(f, v)
Expand Down

2 comments on commit 1cb5dc0

@heiner
Copy link
Contributor

@heiner heiner commented on 1cb5dc0 Jan 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this fix @nhmall, which also fixes facebookresearch/nle#297. Note that the issue also shows up in the current stable version 3.6.6 and should probably be cherry-picked.

@nhmall
Copy link
Contributor Author

@nhmall nhmall commented on 1cb5dc0 Jan 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@heiner , good suggestion about 3.6.6 - it has now been cherry-picked into branch NetHack-3.6.

Please sign in to comment.