bugGNU roff - Bugs: bug #61964, deprecated-enum-float-conversion...

 
 

bug #61964: deprecated-enum-float-conversion in dvi.cpp, color.cpp, and ps.cpp

Submitter:  Bjarni Ingi Gislason <bjarniig>
Submitted:  Sun 30 Jan 2022 12:05:45 AM UTC
   
 
Category:  General Severity:  2 - Minor
Item Group:  Lint Status:  Fixed
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  1.23.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 18 Mar 2022 04:45:32 AM UTC, comment #2: 


commit 87b60fb4578f2cacc00c87869a80bebb5432aa1c
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Tue Mar 15 19:37:30 2022 +1100

    Fix Savannah #61964.

    * src/devices/grodvi/dvi.cpp (dvi_printer::set_color,
      draw_dvi_printer::fill_next):
    * src/devices/grops/ps.cpp (output::put_color):
    * src/libs/libgroff/color.cpp (color::print_color): Explicitly cast
      `enum` divisors to `double`; quietens
      `-Wdeprecated-enum-float-conversion` warnings.

    Fixes <https://savannah.gnu.org/bugs/?61964>.  Thanks to Bjarni Ingi
    Gislason for the report.

    Also update editor aid comments; drop old-style Emacs file-local
    variable setting.


G. Branden Robinson <gbranden>
Group administrator
Sun 06 Mar 2022 01:04:32 PM UTC, comment #1: 

  A fix is to use double(...) also on the denominator.

Bjarni Ingi Gislason <bjarniig>
Sun 30 Jan 2022 12:05:45 AM UTC, original submission:  

Subject: deprecated-enum-float-conversion in dvi.cpp, color.cpp, and
 ps.cpp

Files:

src/devices/grodvi/dvi.cpp
src/libs/libgroff/color.cpp
src/devices/grops/ps.cpp

  Warnings when compiled with "-std=c++20" (gcc (Debian 11.2.0-14)
11.2.0).


  An example for "dvi.cpp":

  CXX      src/devices/grodvi/dvi.o
../src/devices/grodvi/dvi.cpp: In member function 'void dvi_printer::set_color(color*)':
../src/devices/grodvi/dvi.cpp:319:30: warning: arithmetic between floating-point type 'double' and enumeration type 'color::<unnamed enum>' is deprecated [-Wdeprecated-enum-float-conversion]
  319 |                  double(Red) / color::MAX_COLOR_VAL,
      |                  ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~

---End example---

  Other lines are 320-321, 328-331, 335, and 697.

  An example for "color.cpp":

  CXX      src/libs/libgroff/libgroff_a-color.o
../src/libs/libgroff/color.cpp: In member function 'char* color::print_color()':
../src/libs/libgroff/color.cpp:376:25: warning: arithmetic between floating-point type 'double' and enumeration type 'color::<unnamed enum>' is deprecated [-Wdeprecated-enum-float-conversion]
  376 |             double(Red) / MAX_COLOR_VAL,
      |             ~~~~~~~~~~~~^~~~~~~~~~~~~~~

---End example---

  Other lines are 377-378, 382-384, 388-391, and 395.

  For "ps.cpp":

  CXX      src/devices/grops/ps.o
../src/devices/grops/ps.cpp: In member function 'ps_output& ps_output::put_color(unsigned int)':
../src/devices/grops/ps.cpp:374:34: warning: arithmetic between floating-point type 'double' and enumeration type 'color::<unnamed enum>' is deprecated [-Wdeprecated-enum-float-conversion]
  374 |   sprintf(buf, "%.3g", double(c) / color::MAX_COLOR_VAL);
      |                        ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~


Bjarni Ingi Gislason <bjarniig>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gbranden (Updated the item)
  • -email is unavailable- added by bjarniig (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-03-18 gbranden StatusIn Progress Fixed
        Open/ClosedOpen Closed
        Planned ReleaseNone 1.23.0
    2022-03-15 gbranden Item GroupBuild/Installation Lint
        StatusNone In Progress
        Assigned toNone gbranden
    2022-02-01 gbranden CategoryCore General
        Severity3 - Normal 2 - Minor

    Back to the top

    Powered by Savane 3.13-bb6a.
    Corresponding source code