Bug 288442

Summary: y2util/y2log.h should NOT be included by public headers in YaST
Product: [openSUSE] openSUSE 11.0 Reporter: Klaus Kämpf <kkaempf>
Component: YaST2Assignee: Martin Vidner <mvidner>
Status: RESOLVED FIXED QA Contact: Klaus Kämpf <kkaempf>
Severity: Major    
Priority: P5 - None    
Version: Alpha 2   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Klaus Kämpf 2007-06-29 11:12:19 UTC
Logging is an _implementation_ factility, and should not appear in the definition.

Currently, y2util/y2log.h and ycp/y2log.h are included by _header_ files.

IMHO, they should be included by C/C++ code files only.


Background: mixing YaST and openwsman includes leads to redefinition of LOG_ constants and more.
Comment 1 Klaus Kämpf 2007-06-29 11:16:28 UTC
Its currently wrong in the following header files:

scr/run_agent.h
scr/SCRAgent.h
scr/Y2AgentComponent.h
y2util/Y2SLog.h
ycp/ExecutionEnvironment.h
ycp/y2log.h
ycp/YCPCodeCompare.h
ycp/YCPDebugger.h

ycp/y2log.h includes y2util/y2log.h, thereby exposing parts of its implementation.
Comment 2 Martin Vidner 2007-08-08 13:59:10 UTC
OK.
But for example scr/run_agent.h and scr/Y2AgentComponent.h contain template code so I'm afraid I cannot do much there. Please show me a log of the errors so that I know where to start fixing.
Comment 3 Martin Vidner 2007-09-11 09:28:33 UTC
Moving past 10.3.
Comment 4 Klaus Kämpf 2007-09-13 11:23:41 UTC
Use openwsman-devel (part of factory) and 
http://svn.opensuse.org/svn/yast/trunk/openwsman-yast

Look at src/yast_yast.cc and comment out the undefs for LOG_* and error, warning, debug. Then make and the compiler will complain about:

In file included from /usr/include/YaST2/ycp/y2log.h:15,
                 from /usr/include/YaST2/ycp/ExecutionEnvironment.h:21,
                 from yast_yast.cc:32:
/usr/include/YaST2/y2util/y2log.h:24: error:In file included from /usr/include/YaST2/ycp/y2log.h:15,
                 from /usr/include/YaST2/ycp/ExecutionEnvironment.h:21,
                 from yast_yast.cc:32:
/usr/include/YaST2/y2util/y2log.h:24: error: expected identifier before numeric constant
/usr/include/YaST2/y2util/y2log.h:24: error: expected `}' before numeric constant
/usr/include/YaST2/y2util/y2log.h:24: error: expected unqualified-id before numeric constant
/usr/include/YaST2/y2util/y2log.h:30: error: expected declaration before '}' token
 expected identifier before numeric constant
/usr/include/YaST2/y2util/y2log.h:24: error: expected `}' before numeric constant
/usr/include/YaST2/y2util/y2log.h:24: error: expected unqualified-id before numeric constant
/usr/include/YaST2/y2util/y2log.h:30: error: expected declaration before '}' token
Comment 5 Martin Vidner 2008-04-16 15:53:45 UTC
openwsman has LOG_DEGBUG as a define. in yast LOG_DEBUG is an enumeration value, and it is a part of the logging interface. I cannot hide it, I could only rename it, across multiple packages. That would be rather more hassle than the few undefines.

Actually, it helps to include the openswman header after y2log.h. Enum first and define second does not hurt then. I have fixed that in trunk/openwsman-yast.

(BTW, in http://download.opensuse.org/repositories/home:/kwk:/Management/openSUSE_10.3/ , openwsman-devel should require the same version of openwsman, shouldn't it?)