[ZBX-16195] Avoidable compiler warning in zbxprometheus.c Created: 2019 May 30  Updated: 2024 Apr 10  Resolved: 2019 Jun 17

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Proxy (P), Server (S)
Affects Version/s: 4.2.4rc1, 4.4.0alpha1
Fix Version/s: 4.2.4rc1, 4.4.0alpha1, 4.4 (plan)

Type: Problem report Priority: Trivial
Reporter: Glebs Ivanovskis Assignee: Viktors Tjarve
Resolution: Fixed Votes: 0
Labels: codequality, patch, prometheus
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File zbxprometheus.patch    
Team: Team A
Sprint: Sprint 53 (Jun 2019)
Story Points: 0.125

 Description   

Steps to reproduce:

  1. Compile Zabbix server/proxy from sources

Result:

Making all in zbxprometheus
zbxprometheus.c: In function ‘zbx_prometheus_pattern’:
zbxprometheus.c:1535:34: warning: ‘label’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   *value = zbx_strdup(NULL, label->value);
                                  ^~
zbxprometheus.c:1520:27: note: ‘label’ was declared here
   zbx_prometheus_label_t *label;
                           ^~~~~

Expected:
No warnings that can be easily fixed. See zbxprometheus.patch.



 Comments   
Comment by Vladislavs Sokurenko [ 2019 Jun 11 ]

I don't see such warning on gcc (GCC) 9.1.1 20190503 (Red Hat 9.1.1-1), but reproduced if optimization flags are set to gcc

Comment by Viktors Tjarve [ 2019 Jun 14 ]

Releases in:

Thanks to Glebs Ivanovskis for the patch.

Comment by Glebs Ivanovskis [ 2019 Jun 16 ]

Sorry for nitpicking... Too many tabs.

<viktors.tjarve> Thank you for the notice.

Generated at Thu May 02 01:06:23 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.