Bug 57807 - Fix warning on deprecated Poppler::Annotation::window
Summary: Fix warning on deprecated Poppler::Annotation::window
Status: RESOLVED MOVED
Alias: None
Product: poppler
Classification: Unclassified
Component: qt4 frontend (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-02 15:17 UTC by Hib Eris
Modified: 2018-08-20 22:09 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
0001-Fix-warning-on-deprecated-Poppler-Annotation-window.patch (2.68 KB, text/plain)
2012-12-02 15:17 UTC, Hib Eris
Details
deprecated-warning.patch (6.80 KB, patch)
2012-12-08 11:42 UTC, Hib Eris
Details | Splinter Review
Locally disable deprecation warnings (1.72 KB, patch)
2012-12-08 17:46 UTC, Adam Reichold
Details | Splinter Review
Locally disable deprecation warnings (1.34 KB, patch)
2012-12-08 17:53 UTC, Adam Reichold
Details | Splinter Review
Locally disable deprecation warnings (1.42 KB, patch)
2012-12-08 20:40 UTC, Adam Reichold
Details | Splinter Review

Description Hib Eris 2012-12-02 15:17:16 UTC
Created attachment 70930 [details]
0001-Fix-warning-on-deprecated-Poppler-Annotation-window.patch

The use of Poppler::Annotation::window is deprecated for
external use, but its use cannot be avoided internally
in the class constructor as long as it is not removed
completely. Thus, this patch disables deprecation when
compiling poppler-annotation.cc

Fixes warning:

  CXX    libpoppler_qt4_la-poppler-annotation.lo
poppler-annotation.cc: In constructor 'Poppler::Annotation::Annotation(Poppler::AnnotationPrivate&)':
poppler-annotation.cc:789:18: warning: 'Poppler::Annotation::window' is deprecated (declared at poppler-annotation.h:248) [
-Wdeprecated-declarations]
poppler-annotation.cc:791:5: warning: 'Poppler::Annotation::window' is deprecated (declared at poppler-annotation.h:248) [-
Wdeprecated-declarations]
poppler-annotation.cc:791:20: warning: 'Poppler::Annotation::window' is deprecated (declared at poppler-annotation.h:248) [
-Wdeprecated-declarations]
poppler-annotation.cc: In constructor 'Poppler::Annotation::Annotation(Poppler::AnnotationPrivate&, const QDomNode&)':
poppler-annotation.cc:799:18: warning: 'Poppler::Annotation::window' is deprecated (declared at poppler-annotation.h:248) [
-Wdeprecated-declarations]
poppler-annotation.cc:803:5: warning: 'Poppler::Annotation::window' is deprecated (declared at poppler-annotation.h:248) [-
Wdeprecated-declarations]
poppler-annotation.cc:803:20: warning: 'Poppler::Annotation::window' is deprecated (declared at poppler-annotation.h:248) [
-Wdeprecated-declarations]
Comment 1 Adam Reichold 2012-12-05 19:29:30 UTC
Hello Hib,

I am not sure whether it is good style to work the solution of this implementation problem into a public header. At least for GCC 4.6 and later, it should be possible to resolve this locally using e.g.

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
Annotation::Annotation( AnnotationPrivate &dd, const QDomNode &annNode )
    : d_ptr( &dd )
{
[...]
}
#pragma GCC diagnostic pop

Not sure what is worse, putting it into the headers or using a solution that only works for a single compiler. :-(
Comment 2 Hib Eris 2012-12-08 11:42:09 UTC
Created attachment 71193 [details] [review]
deprecated-warning.patch

(In reply to comment #1)

> I am not sure whether it is good style to work the solution of this
> implementation problem into a public header.

You are right. I reworked my patch to a more generic solution defining POPPLER_DECL_DEPRECATED to replace Q_DECL_DEPRECATED.

What do you think of it?
Comment 3 Albert Astals Cid 2012-12-08 17:12:07 UTC
I don't think the current patch is good, it'd let me use window anywhere and i wouldn't realize it's wrong, it would be acceptable if you wrappred somehow the "deprecated but needed" code in  the constructors, no idea how to achieve that though
Comment 4 Hib Eris 2012-12-08 17:31:59 UTC
(In reply to comment #3)
> I don't think the current patch is good, it'd let me use window anywhere and
> i wouldn't realize it's wrong

Do you really mean "anywhere", or just "anywhere in poppler-annotation.cc"?
If it is the first, my patch is certainly not good.

However, I think it can not be avoided that you can use window anywhere in poppler-annotation.cc. It is upto the poppler developpers to know that it is deprecated and only part of the implementation for backward compatibility.
Comment 5 Albert Astals Cid 2012-12-08 17:42:21 UTC
I meant "anywhere in poppler-annotation.cc"

Sure, i agree it's up to us to know that stuff, but having a new warning creep up is an easy way to get the signal that something might not be correct. 

All in all i think that the added "security" that warning gives me is better than silencing some warnings that i already know are going to be there.

Anyone else has an opinion on this?
Comment 6 Adam Reichold 2012-12-08 17:46:50 UTC
Created attachment 71211 [details] [review]
Locally disable deprecation warnings

Hello,

Personally, I think those warnings are rather helpful since they remind us that this deprecated member should go away at some point in time. (Even though I don't know how deprecation periods are currently handled in Poppler.)

Besides that, I think you really want to temporarily and locally disable the warning and not the deprecation itself. If one really wants to do this and still tackle several compilers, maybe something like the attached patch could be used.

But still, I think the warning should stay with a long-term plan on removing the offender, i.e. the declaration itself.

Regards, Adam.
Comment 7 Adam Reichold 2012-12-08 17:53:35 UTC
Created attachment 71212 [details] [review]
Locally disable deprecation warnings

Sorry, there was superfluous BLOCK/RESET pair in the first patch...
Comment 8 Albert Astals Cid 2012-12-08 20:13:08 UTC
I like Adam's patch better, but he agrees with me that the warnings are "good", let's see if someone else comments before we apply/reject the patch
Comment 9 Adam Reichold 2012-12-08 20:40:18 UTC
Created attachment 71217 [details] [review]
Locally disable deprecation warnings

Better add a trivial fallback for unknown compiler if this is going into master.
Comment 10 GitLab Migration User 2018-08-20 22:09:05 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/poppler/poppler/issues/218.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.