This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/20639] New: Inconsistency in definitions of fputwc(), putwc() and putwchar() in glibc


https://sourceware.org/bugzilla/show_bug.cgi?id=20639

            Bug ID: 20639
           Summary: Inconsistency in definitions of fputwc(), putwc() and
                    putwchar() in glibc
           Product: glibc
           Version: 2.23
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: igor.liferenko at gmail dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

Hi all,

fputwc(), putwc() and putwchar() take argument of type wchar_t instead of
wint_t. This causes GCC to issue warnings.

This is the example for putwchar(). Compile with "gcc -Wconversion bug.c"

    #include <locale.h>
    #include <wchar.h>
    int main(void)
    {
      setlocale(LC_CTYPE, "en_US.UTF-8");
      putwchar(getwchar());
      return 0;
    }

This is the output:

    bug.c: In function ‘main’:
    bug.c:6:12: warning: conversion to ‘wchar_t {aka int}’ from ‘wint_t {aka
unsigned int}’ may change the sign of the result [-Wsign-conversion]
       putwchar(getwchar());
                ^~~~~~~~

I know that wint_t and wchar_t are identical, but function interfaces should be
fixed to remove compiler warnings.

Regards,
Igor

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]