Opened 8 years ago

Last modified 4 years ago

#858 new enhancement

silent MSVC warnings on libdns++

Reported by: fdupont Owned by:
Priority: low Milestone: Windows
Component: Unclassified Version: git
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity: Low
Sub-Project: DNS Feature Depending on Ticket: windows
Estimated Difficulty: 0.0 Add Hours to Ticket: 0
Total Hours: 0 Internal?: no

Description

I'll collect MSVC warnings in VS2005/2008/2010 and try to address them.
Some are spurious (as a warning for {} while(0) in macros) and should be avoided
with a pragma, some are real (mainly incompatible integer operations) and should
be fixed (for instance by a cast). As far as I know none is critical so
I put this ticket in enhancements.
Note at least a common one is related to C++: VS2010 complains about missing and
impossible to generate copy operation in class definition...

Subtickets

Attachments (4)

vs2008R.log (8.8 KB) - added by fdupont 8 years ago.
log of Release (W3) build by Visual Studio 2008
vs2008D.log (160.8 KB) - added by fdupont 8 years ago.
log of Debug (W4) build by Visual Studio 2008
vs2010R.log (8.9 KB) - added by fdupont 8 years ago.
log of Release (W3) build by Visual Stdio 2010
vs2010D.log (160.9 KB) - added by fdupont 8 years ago.
log of Debug (W4) build by Visual Studio 2010

Download all attachments as: .zip

Change History (9)

Changed 8 years ago by fdupont

log of Release (W3) build by Visual Studio 2008

Changed 8 years ago by fdupont

log of Debug (W4) build by Visual Studio 2008

Changed 8 years ago by fdupont

log of Release (W3) build by Visual Stdio 2010

Changed 8 years ago by fdupont

log of Debug (W4) build by Visual Studio 2010

comment:1 Changed 8 years ago by fdupont

The exact MSVC issue is:

Compiler Warning (level 4) C4512

'class' : assignment operator could not be generated

The compiler cannot generate an assignment operator for the given class. No assignment operator was created.

An assignment operator for the base class that is not accessible by the derived class can cause this warning.

To avoid this warning, specify a user-defined assignment operator for the class.

The compiler will also generate an assignment operator function for a class that does not define one. This assignment operator is a memberwise copy of the data members of an object. Because const data items cannot be modified after initialization, if the class contains a const item, the default assignment operator would not work. Another cause of the C4512 warning is a declaration of a nonstatic data member of reference type.

You can resolve the C4512 warning for your code in one of three ways:

  • Explicitly define an assignment operator for the class.
  • Remove const or the reference operator from the data item in the class.
  • Use the #pragma warning statement to suppress the warning.

=> I suggest the first one, BTW boost has many such definitions to avoid this particular warning.

comment:2 Changed 8 years ago by fdupont

BTW this was mostly done in the last trac826 branch versions and not for libdns++ only, at the exception of missing integer casts (I fixed only trivial for iteration variable).

comment:3 Changed 8 years ago by shane

  • Feature Depending on Ticket set to windows
  • Milestone New Tasks deleted

comment:4 Changed 5 years ago by tomek

  • Milestone set to Remaining BIND10 tickets

comment:5 Changed 4 years ago by tomek

  • Milestone changed from Remaining BIND10 tickets to Windows
  • Version set to git

If this ticket is no longer applicable or useful, feel free to close it.

Note: See TracTickets for help on using tickets.