Bug 626329
Summary: | nested pthread_cleanup_push() does not work with -Wshadow -Werror | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Stas Sergeev <stsp2> |
Component: | gcc | Assignee: | Jakub Jelinek <jakub> |
Status: | CLOSED WONTFIX | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | medium | Docs Contact: | |
Priority: | low | ||
Version: | 17 | CC: | aravindvijayan224185, jakub, mnewsome |
Target Milestone: | --- | Keywords: | Reopened |
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2013-08-01 18:24:59 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Stas Sergeev
2010-08-23 08:18:48 UTC
That cannot be fixed without compiler support, perhaps through a declaration attribute to suppress the warning. I think an attribute is a perfectly sane solution. Is there one already, or should be implemented in gcc? Or maybe pragma? I am asking because I have the same problem with an own macros. Usually __COUNTER__ macro can be used for that kind of things, if you suffix your local vars with a macro argument and pass __COUNTER__ to that argument from a wrapper macro. Unfortunately, for pthread_cleanup_push/pop that doesn't work too well, because pthread_cleanup_pop is a separate macro and needs to access corresponding pthread_cleanup_push variables. GCC 4.6 also has _Pragma ("GCC diagnostic {push,pop,ignored \"-Wshadow\"}"), unfortunately as this is a macro expansion it doesn't work well unless glibc disabled all -Wshadow warnings in between pthread_cleanup_push and pthread_cleanup_pop: #define A \ { \ _Pragma ("GCC diagnostic push"); \ _Pragma ("GCC diagnostic ignored \"-Wshadow\""); \ int var = 6; #define B \ var++; _Pragma ("GCC diagnostic pop"); } void foo (void) { A; A; B; B; } Many thanks! Maybe a naive question, but what if I redefine the macros in your example in the following way: --- #define A \ { \ _Pragma ("GCC diagnostic push"); \ _Pragma ("GCC diagnostic ignored \"-Wshadow\""); \ int var = 6; \ _Pragma ("GCC diagnostic pop"); #define B \ var++; --- Will there still be a problem then? Yes, that won't work, because GCC currently (AFAIK Dodji Seketeli is working on it, but it won't work for -save-temps/ccache etc. anyway) doesn't preserve macro expansion locations. So, all tokens from the macro A expansion get the same location (the location where in the source the macro is used). As GCC diagnostic macro works by setting up a range of locations for which the warning is ignored/errored on/warned etc., if ignored and pop have the same location, it means -Wshadow will still complain. How about treating the "ignore and pop on the same location" as "ignore till the next line"? Or is it too much of a hack? Just an idea. Maybe a bad one. :) Hi Jakub. Sorry for bothering you with an obviously support questions, but I am trying what you have suggested, and the following doesn't work: --- #define M(i) i ## __COUNTER__ int main() { int M(i), M(i); return 0; } --- counter.c:5: error: redeclaration of 'i__COUNTER__' with no linkage counter.c:5: note: previous declaration of 'i__COUNTER__' was here counter.c:5: warning: unused variable 'i__COUNTER__' Could you please hint me at what am I missing here? #define M_2(i, cntr) i##cntr #define M_1(i, cntr) M_2(i, cntr) #define M(i) M_1(i, __COUNTER__) int main() { int M(i), M(i); return 0; } Thank you! This message is a reminder that Fedora 13 is nearing its end of life. Approximately 30 (thirty) days from now Fedora will stop maintaining and issuing updates for Fedora 13. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '13'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 13's end of life. Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 13 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora please change the 'version' of this bug to the applicable version. If you are unable to change the version, please add a comment here and someone will do it for you. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. The process we are following is described here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping Thank you for the bug report,i think your problem was revolved let me close this bug. -- Fedora Bugzappers volunteer triage team https://fedoraproject.org/wiki/BugZappers How? In what version of <what> is this fixed? I don't have a fedora-16 here to check but I am pretty sure it is not fixed as of yet, so any proof? Lets get this open until the fix is confirmed. I don't think this could have silently fix itself. (In reply to comment #12) > Thank you for the bug report,i think your problem was revolved let me close > this bug. > > > > -- > Fedora Bugzappers volunteer triage team > https://fedoraproject.org/wiki/BugZappers Sorry for the careless activity, while loitering through bugs, when i saw that: (In reply to comment #10) > Thank you! I do not even pay a time slice to go through the data and just closed the bug i am thankful to you for your valuable replay.. "Lets get this open until the fix is confirmed." This message is a notice that Fedora 15 is now at end of life. Fedora has stopped maintaining and issuing updates for Fedora 15. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At this time, all open bugs with a Fedora 'version' of '15' have been closed as WONTFIX. (Please note: Our normal process is to give advanced warning of this occurring, but we forgot to do that. A thousand apologies.) Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, feel free to reopen this bug and simply change the 'version' to a later Fedora version. Bug Reporter: Thank you for reporting this issue and we are sorry that we were unable to fix it before Fedora 15 reached end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged to click on "Clone This Bug" (top right of this page) and open it against that version of Fedora. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. The process we are following is described here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping Can this now be fixed with -ftrack-macro-expansion? This message is a reminder that Fedora 17 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 17. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '17'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 17's end of life. Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 17 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior to Fedora 17's end of life. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. Fedora 17 changed to end-of-life (EOL) status on 2013-07-30. Fedora 17 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. Thank you for reporting this bug and we are sorry it could not be fixed. |