Skip to content

bpo-46513: Remove AC_C_CHAR_UNSIGNED / __CHAR_UNSIGNED__ #30851

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
:program:`configure` no longer uses ``AC_C_CHAR_UNSIGNED`` macro and
``pyconfig.h`` no longer defines reserved symbol ``__CHAR_UNSIGNED__``.
4 changes: 0 additions & 4 deletions Modules/audioop.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@

#include "Python.h"

#if defined(__CHAR_UNSIGNED__)
#if defined(signed)
/* This module currently does not work on systems where only unsigned
characters are available. Take it out of Setup. Sorry. */
Copy link
Contributor

Choose a reason for hiding this comment

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

The last part of the comment should be removed, it is confusing without the preprocessor guards. I'd consider just dropping the comment, a compiler where "signed char" is not signed should be considered broken.

Copy link
Member

Choose a reason for hiding this comment

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

The comment was introduced by b6775db in 1994, just five years after the first ever C standard was published. Internet distribution was slow and software companies were rigid back then so no surprise compatibility with per vendor compiler quirks was a real deal.

Copy link
Member

Choose a reason for hiding this comment

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

Please remove this outdated comment. audioop explicitly uses signed char and unsigned char. Maybe to avoid any risk of confusion, the C code should use int8_t and uint8_t.

Copy link
Member Author

Choose a reason for hiding this comment

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

The comment is pining for the fjords.

#endif
#endif

static const int maxvals[] = {0, 0x7F, 0x7FFF, 0x7FFFFF, 0x7FFFFFFF};
/* -1 trick is needed on Windows to support -0x80000000 without a warning */
Expand Down
33 changes: 0 additions & 33 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -4699,7 +4699,6 @@ fi

# checks for compiler characteristics

AC_C_CHAR_UNSIGNED
AC_C_CONST

AC_CACHE_CHECK([for working signed char], [ac_cv_working_signed_char_c], [
Expand Down
5 changes: 0 additions & 5 deletions pyconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -1728,11 +1728,6 @@
/* Define on FreeBSD to activate all library features */
#undef __BSD_VISIBLE

/* Define to 1 if type `char' is unsigned and you are not using gcc. */
#ifndef __CHAR_UNSIGNED__
# undef __CHAR_UNSIGNED__
#endif

/* Define to 'long' if <time.h> doesn't define. */
#undef clock_t

Expand Down