Opened 12 years ago

Last modified 9 months ago

#9460 new enhancement

Edit source code to remove compilation warnings, to allow -Werror (easy)

Reported by: mmadia Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: - General Version: R1/Development
Keywords: GCI Cc:
Blocked By: #12653, #12662, #12663 Blocking:
Platform: All

Description (last modified by pulkomandy)

This is a generalized ticket to expose an area to contribute.

Several portions of Haiku's code is not compiled with -Werror. Those portions can be found in build/jam/ArchitectureRules.

Some of them only fail on GCC 2 vs. both GCC's. Take care to test with both compilers. As of hrev45297 these are those directories:

#	EnableWerror src add-ons accelerants intel_extreme ;
#	EnableWerror src add-ons accelerants matrox ;
#	EnableWerror src add-ons accelerants nvidia ;
#	EnableWerror src add-ons accelerants radeon ;
#	EnableWerror src add-ons accelerants radeon_hd ;
#	EnableWerror src add-ons input_server filters ;
#	EnableWerror src add-ons input_server methods ;
#	EnableWerror src add-ons kernel bus_managers acpi ;
#	EnableWerror src add-ons kernel bus_managers firewire ;
#	EnableWerror src add-ons kernel bus_managers ps2 ; # gcc2
#	EnableWerror src add-ons kernel debugger ; # gcc2
#	EnableWerror src add-ons kernel drivers audio ;
#	EnableWerror src add-ons kernel drivers graphics ;
#	EnableWerror src add-ons kernel drivers input ;
#	EnableWerror src add-ons kernel drivers network ;
#	EnableWerror src add-ons kernel drivers power ;
#	EnableWerror src add-ons kernel file_systems ext2 ;
#	EnableWerror src add-ons kernel file_systems fat ;
#	EnableWerror src add-ons kernel file_systems googlefs ;
#	EnableWerror src add-ons kernel file_systems ntfs ;
#	EnableWerror src add-ons kernel file_systems reiserfs ;
#	EnableWerror src add-ons kernel network datalink_protocols ;
#	EnableWerror src add-ons kernel network stack ;
#	EnableWerror src add-ons media media-add-ons usb_webcam ;
#	EnableWerror src add-ons media media-add-ons video_producer_demo ;
#	EnableWerror src add-ons media plugins asf_reader ;
#	EnableWerror src add-ons media plugins avi_reader ;
#	EnableWerror src add-ons media plugins ffmpeg ;
#	EnableWerror src add-ons media plugins matroska ;
#	EnableWerror src add-ons media plugins mov_reader ;
#	EnableWerror src add-ons media plugins mp3_reader ;
#	EnableWerror src add-ons media plugins ogg ;
#	EnableWerror src add-ons media plugins raw_decoder ;
#	EnableWerror src add-ons media plugins speex ;
#	EnableWerror src add-ons media plugins wav_reader ;
#	EnableWerror src add-ons translators exr ;
#	EnableWerror src add-ons translators hpgs ;
#	EnableWerror src add-ons translators jpeg ; # gcc2
#	EnableWerror src add-ons translators png ; # gcc2
#	EnableWerror src add-ons translators stxt ;
#	EnableWerror src add-ons translators wonderbrush ;

The process would be:

  • Uncomment one of these lines in the ArchitectureRules file,
  • Build Haiku
  • Compilation will fail because of a compiler warning now being considered an error
  • Alter the code to fix the warning
  • Submit your change to Gerrit for code review

Mention this ticket in the commit message of your changes (include a line saying "Fixes: #9640") to help us find what your work is related to.

Eventually, all warnings will be fixed and we can enable Werror globally on all our sourcecode.

Note that there are exceptions to this: some code is "vendored", that is, we copied it from other projects. For example, the NTFS driver contains code from the NTFS-3G project. In this case, the fixes should be discussed with the original developers of the code, and made on their project if they accept it, to make it easier for us to merge in later versions of their code. So, if you are new to Haiku and want to help with this, it's better to start from parts of the sourcecode that are not in this situation (ask us if you don't know how to determine this).

Change History (15)

comment:1 by mmadia, 12 years ago

Description: modified (diff)

comment:2 by waddlesplash, 9 years ago

Milestone: R1Unscheduled

comment:3 by MichaelCrawford, 9 years ago

Blocked By: 12653 added

comment:4 by MichaelCrawford, 9 years ago

Blocked By: 12662 added

comment:5 by MichaelCrawford, 9 years ago

Blocked By: 12663 added

comment:6 by pulkomandy, 5 years ago

Description: modified (diff)
Keywords: GCI added
Summary: Edit source code to remove compilation warnings, to allow -WerrorEdit source code to remove compilation warnings, to allow -Werror (easy)

I think this makes a good easy task and could be added to the next run of Google Code-In.

comment:7 by diver, 4 years ago

Description: modified (diff)

comment:8 by pulkomandy, 4 years ago

Description: modified (diff)

comment:9 by pulkomandy, 4 years ago

Description: modified (diff)

comment:10 by Coldfirex, 3 years ago

Updated list as of hrev55181+55:

#	EnableWerror src add-ons input_server methods pen ;
#	EnableWerror src add-ons kernel bus_managers firewire ;
#	EnableWerror src add-ons kernel debugger ; # gcc2
#	EnableWerror src add-ons kernel drivers audio ;
#	EnableWerror src add-ons kernel drivers bus ;
#	EnableWerror src add-ons kernel drivers disk ;
#	EnableWerror src add-ons kernel drivers graphics ;
#	EnableWerror src add-ons kernel drivers input ;
#	EnableWerror src add-ons kernel drivers network ;
#	EnableWerror src add-ons kernel drivers power ;
#	EnableWerror src add-ons kernel file_systems ext2 ;
#	EnableWerror src add-ons kernel file_systems fat ;
#	EnableWerror src add-ons kernel file_systems googlefs ;
#	EnableWerror src add-ons kernel file_systems netfs ;
#	EnableWerror src add-ons kernel file_systems nfs ;
#	EnableWerror src add-ons kernel file_systems ntfs ;
#	EnableWerror src add-ons kernel file_systems ramfs ;
#	EnableWerror src add-ons kernel file_systems reiserfs ;
#	EnableWerror src add-ons kernel network datalink_protocols ;
#	EnableWerror src add-ons kernel network stack ;
#	EnableWerror src add-ons media media-add-ons usb_webcam ;
#	EnableWerror src add-ons media media-add-ons video_producer_demo ;
#	EnableWerror src add-ons media plugins ffmpeg ;
#	EnableWerror src add-ons media plugins raw_decoder ;
#	EnableWerror src add-ons translators jpeg2000 ;

comment:11 by cassisian, 3 years ago

Fixed (not all by me):

  • src add-ons kernel file_systems ext2 (6)
  • src add-ons media media-add-ons video_producer_demo (2)
  • src add-ons kernel network stack (4)
  • src add-ons kernel network datalink_protocols(5)
  • src add-ons media plugins raw_decoder (3)

Fixes for:

  • src add-ons media media-add-ons usb_webcam (1)

are under review.

(1) https://review.haiku-os.org/c/haiku/+/4501

(2) https://review.haiku-os.org/c/haiku/+/4504

(3) https://review.haiku-os.org/c/haiku/+/4503

(4) https://review.haiku-os.org/c/haiku/+/4512 [Quick win, no related warnings]

(5) https://review.haiku-os.org/c/haiku/+/4513 [Quick win, no related warnings]

(6) https://review.haiku-os.org/c/haiku/+/4453

Version 6, edited 3 years ago by cassisian (previous) (next) (diff)

comment:12 by Jim906, 3 years ago

Fixed:

src add-ons kernel drivers disk (https://review.haiku-os.org/c/haiku/+/5284)

Last edited 3 years ago by Jim906 (previous) (diff)

comment:13 by pulkomandy, 11 months ago

Description: modified (diff)

comment:14 by MuhamedEmad, 9 months ago

Hi, is this issue still up for contribution. if yes then I am thinking to start with this line "#EnableWerror src add-ons kernel drivers audio ;" which is line 683. if it's okay then I will start working right away. if not I want a suggestion for an easy task.

comment:15 by pulkomandy, 9 months ago

Hello,

Yes, there doesn't seem to be any 3rd party code in the "audio" directory, so it will not be a problem to modify the code to fix warnings.

I suggest replacing #EnableWerror src add-ons kernel drivers audio ; by one line for each of the subdirectories of audio, and then work on them one by one. Maybe start with the "null" driver which is very small, so you can make an easy first contribution and make sure everythign is set up correctly for submitting your changes.

Then continue with the other drivers one by one.

Let us know if you need more help with this :)

Note: See TracTickets for help on using tickets.