Skip to content
  • Mauro Carvalho Chehab's avatar
    benchmarks: fix calloc calls with inverted arguments · 58ca03ee
    Mauro Carvalho Chehab authored
    The new gcc version 14 now complains when calloc is called
    with inverted arguments:
    
    	../benchmarks/gem_exec_reloc.c:85:31: warning: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
    	   85 |         target = calloc(sizeof(*target), num_relocs);
    	      |                               ^
    	../benchmarks/gem_exec_reloc.c:85:31: note: earlier argument should specify number of elements, later size of each element
    
    Replace all occurrences of calloc that were warned on gcc 14 by
    placing the arguments at the right order.
    
    Logic fixed using this small python script, written specifically
    to catch gcc calloc warnings:
    
        #!/usr/bin/env python3
        import re
        warnings = [
        	"lib/igt_kms.c:2781",
        	"lib/igt_kms.c:2809",
        	"lib/igt_kms.c:2858",
        	"lib/igt_chamelium.c:156",
        	"lib/igt_chamelium.c:1519",
        	"tests/kms_atomic_transition.c:483",
        	"tests/kms_atomic_trans...
    58ca03ee