Re: Functions that should be static

2009-01-08 Thread Francois Gouget

Thanks for the help with this task. With the last round of patches we 
are now down to about 280 warnings so there's definite progress. Here's 
the updated list:

dlls/cabinet/fdi.o: make_decode_table should be made static
dlls/cabinet/fdi.o: QTMupdatemodel should be made static
dlls/comctl32/tests/msg.o: flush_sequence should be made static
dlls/d3dxof/parsing.o: parse_template_option_info should be made static
dlls/dbghelp/storage.o: hash_table_find should be made static
dlls/dmime/patterntrack.o: DMUSIC_CreateDirectMusicPatternTrackImpl should be 
made static
dlls/dmime/tool.o: DMUSIC_CreateDirectMusicobjImpl should be made static
dlls/dplayx/dplay.o: cbDeleteGroupsElem should be made static
dlls/dplayx/dplay.o: cbDeletePlayerElem should be made static
dlls/dplayx/dplayx_global.o: DPLAYX_DestroyLobbyApplication should be made 
static
dlls/dplayx/dplayx_global.o: DPLAYX_SetLocalSession should be made static
dlls/dplayx/name_server.o: NS_GetOtherMagic should be made static
dlls/dplayx/name_server.o: NS_SetRemoteComputerAsNameServer should be made 
static
dlls/dsound/capture.o: DirectSoundCaptureDevice_AddRef should be made static
dlls/fusion/assembly.o: assembly_get_architecture should be made static
dlls/fusion/fusion.o: CompareAssemblyIdentity should be made static
dlls/fusion/fusion.o: GetAssemblyIdentityFromFile should be made static
dlls/inetcomm/internettransport.o: InternetTransport_Read should be made static
dlls/iphlpapi/ifenum.o: getInterfaceEntryByIndex should be made static
dlls/iphlpapi/ifenum.o: getInterfacePhysicalByName should be made static
dlls/itss/chm_lib.o: chm_enumerate should be made static
dlls/jscript/parser.tab.o: parser_parse should be made static
dlls/mountmgr.sys/mountmgr.o: DriverEntry should be made static
dlls/msacm32/internal.o: MSACM_UnregisterLocalDriver should be made static
dlls/mshtml/htmlelemcol.o: HTMLElementCollection_Create should be made static
dlls/msi/cond.tab.o: cond_parse should be made static
dlls/msi/database.o: MSI_DatabaseExport should be made static
dlls/msi/database.o: MSI_DatabaseImport should be made static
dlls/msi/dialog.o: msi_dialog_register_class should be made static
dlls/msi/events.o: ControlEvent_UnSubscribeToEvent should be made static
dlls/msi/helpers.o: msi_ui_error should be made static
dlls/msi/helpers.o: reduce_to_shortfilename should be made static
dlls/msi/media.o: find_published_source should be made static
dlls/msi/media.o: msi_load_media_info should be made static
dlls/msi/preview.o: MSI_EnableUIPreview should be made static
dlls/msi/preview.o: MSI_PreviewDialogW should be made static
dlls/msi/record.o: MSI_RecordDataSize should be made static
dlls/msi/record.o: MSI_RecordSetStream should be made static
dlls/msi/record.o: MSI_RecordSetStringA should be made static
dlls/msi/registry.o: MSIREG_OpenInstallerFeaturesKey should be made static
dlls/msi/registry.o: msi_version_dword_to_str should be made static
dlls/msi/sql.tab.o: sql_parse should be made static
dlls/msi/string.o: msi_id2stringA should be made static
dlls/msi/string.o: msi_id2stringW should be made static
dlls/msi/string.o: msi_strcmp should be made static
dlls/msi/string.o: msi_string2idA should be made static
dlls/msi/table.o: db_get_raw_stream should be made static
dlls/msi/table.o: encode_streamname should be made static
dlls/netapi32/nbnamecache.o: NBNameCacheUpdateNBName should be made static
dlls/ole32/ole16.o: IMalloc16_Constructor should be made static
dlls/qcap/enummedia.o: FreeMediaType should be made static
dlls/qcap/pin.o: IPinImpl_QueryInternalConnections should be made static
dlls/riched20/caret.o: ME_SelectByType should be made static
dlls/riched20/caret.o: ME_UpdateSelection should be made static
dlls/riched20/editor.o: ME_DestroyEditor should be made static
dlls/riched20/editor.o: ME_FindNextURLCandidate should be made static
dlls/riched20/editor.o: ME_HandleMessage should be made static
dlls/riched20/editor.o: ME_IsCandidateAnURL should be made static
dlls/riched20/editor.o: ME_LinkNotify should be made static
dlls/riched20/editor.o: ME_MakeEditor should be made static
dlls/riched20/editor.o: ME_UpdateLinkAttribute should be made static
dlls/riched20/editor.o: ME_UpdateSelectionLinkAttribute should be made static
dlls/riched20/editor.o: REComboWndProc should be made static
dlls/riched20/editor.o: REListWndProc should be made static
dlls/riched20/list.o: ME_DITypesEqual should be made static
dlls/riched20/list.o: ME_FindItemFwdOrHere should be made static
dlls/riched20/paint.o: ME_DrawParagraph should be made static
dlls/riched20/paint.o: ME_GetYScrollVisible should be made static
dlls/riched20/paint.o: ME_InvalidateFromOfs should be made static
dlls/riched20/paint.o: ME_QueueInvalidateFromCursor should be made static
dlls/riched20/paint.o: ME_Scroll should be made static
dlls/riched20/para.o: ME_GetParaFormat should be made static
dlls/riched20/para.o: ME_MarkForWrapping should be made static
dlls/riched20/para.o: ME_SetParaFormat should be made static

Re: Functions that should be static

2009-01-08 Thread Andrew Talbot
Francois Gouget wrote:

 
 Thanks for the help with this task. With the last round of patches we
 are now down to about 280 warnings so there's definite progress. Here's
 the updated list:
 
 [...]

Here are the apparently unused functions I have encountered in the dlls so
far. Please speak up for any you want kept or any you can authoritatively
declare as being no longer required.

dlls/cabinet/fdi.c: QTMupdatemodel(), make_decode_table()
dlls/dbghelp/storage.c: hash_table_find()
dls/dplayx/dplayx_global.c: DPLAYX_DestroyLobbyApplication(),
DPLAYX_SetLocalSession() [#if 0'd out in name_server.c]
dls/dplayx/name_server.c: NS_SetRemoteComputerAsNameServer(),
NS_GetOtherMagic() [#if 0'd out in dplayx_messages.c]
dlls/dsound/capture.c: DirectSoundCaptureDevice_AddRef()
dlls/fusion/assembly.c: assembly_get_architecture() [stub]
dlls/inetcomm/internettransport.c: InternetTransport_Read()
dlls/iphlpapi/ifenum.c: getInterfaceEntryByIndex()
dlls/itss/chm_lib.c: chm_enumerate()
dlls/mountmgr.sys/mountmgr.c: DriverEntry()

Thanks.

-- 
Andy.






Re: Functions that should be static

2009-01-08 Thread Juan Lang
 dlls/iphlpapi/ifenum.c: getInterfaceEntryByIndex()

This one's definitely dead, go ahead and remove it.

Thanks,
--Juan




Re: Functions that should be static

2008-12-22 Thread Christian Costa
Francois Gouget a écrit :
 On Sat, 20 Dec 2008, Christian Costa wrote:
 [...]
   
 If you have a class A (with methods implemented in file 1) that inherits from
 another class B (methods in file B).
 The class A may overrides some methods of B which may become unused if B is
 never instanciated and B methods not reused.
 They will be tracked by your script then.
 We could make these functions static or worst remove then but from object
 programming pov is not good.
 

 I don't see any reason not to make the methods of B static, whether 
 class A exists or not. Note that 'static' does not prevent a function 
 from being called from another object file if you give a pointer to them 
 to that other file (as you do with the virtual table).

 Also the compiler will not complain that these functions are unused 
 because they are indeed used: you take their address.

   
Yes. That's right we can pick the function address from a vtable but in 
that case
we cannot build another one statically as we use to i.e :

const IPinVtbl MyInputPin_Vtbl = {
InputPin_Vtbl.QueryInterface, = not a constant
MyInputPin_AddRef,
...
}

The compiler will complain this is not a constant. We could never build 
a vtable statically except for the top base class.
And how could we build a vtable dynamically from another one which is 
also build dynamically ?
I guess, we need to rely on constructor of the parent class which will 
call in turn his own parent and so on. This is a big change.
Maybe it's off topic, but msvcirt exports methods as well as vtables. I 
don't know how all of this works !






Re: Functions that should be static

2008-12-21 Thread Kai Blin
On Thursday 18 December 2008 10:09:02 Francois Gouget wrote:

 dlls/secur32/secur32.dll.so: SECUR32_initNegotiateSP

This function would (and at some point did) register the Negotiate security 
provider. It's not called right now because the provider is not implemented 
and registering it broke some applications. The better solution here would be 
to completely remove negotiate.c and readd it once it's implemented.

 dlls/secur32/secur32.dll.so: SECUR32_strdupW

This should be used by functions like e.g. QueryContextAttributesW. It's just 
that we cheat and not implement the parts of that function that need to 
allocate strings yet.

Cheers,
Kai

-- 
Kai Blin
WorldForge developer  http://www.worldforge.org/
Wine developerhttp://wiki.winehq.org/KaiBlin
Samba team member http://www.samba.org/samba/team/
--
Will code for cotton.


signature.asc
Description: This is a digitally signed message part.



Re: Functions that should be static

2008-12-21 Thread Andrew Talbot
Francois Gouget wrote:

 
 I have attached a script that identifies functions that should be made
 static (among other things). There are approximately 450 of them, there
 should be pretty efw false positives, and I will look into them
 eventually. But if someone beats me to it I sure won't complain g.
 

Hi Francois,

The dlls/advapi32/svcctl_c.c: svcctl_*() functions are peculiar, too. They
look like they need to be exported in some manner.

-- 
Andy.






Re: Functions that should be static

2008-12-20 Thread Christian Costa
Francois Gouget a écrit :
 On Thu, 18 Dec 2008, Christian Costa wrote:
 [...]
   
 For 1) Why not adding a keyword to mark these functions. Something like 
 WINAPI which resolve to nothing but that can be tracked by your script.
 

 We could potentially go this way if I merge these checks with 
 winapi_check one day. But for now I prefer not to touch Wine's code. 
 Besides there's really only about a handful of these.

   
 I would add another item for more object oriented stuff. Some default 
 implentations can be written but not always used.
 This is sort of templates. This is used in quartz for example.
 

 Do you have a specific example of this?

   
If you have a class A (with methods implemented in file 1) that inherits 
from another class B (methods in file B).
The class A may overrides some methods of B which may become unused if B 
is never instanciated and B methods not reused.
They wil be tracked by your script then.
We could make these functions static or worst remove then but from 
object programming pov is not good.
Implement objects or interfaces in C is a little messy. Haven't 
something more consistent would be more convenient I think.
That would we good if we could treat a class as a whole rather that just 
independants C functions.

That said, in quartz only pins use that currently (maybe more base 
classes could be written like what's done in Direct Show base classes 
(through strmbase.lib)).
And if we move that code to a separate static lib (strmbase like in 
DirectShow), functions will be exported and the problem will  disappear.
Maybe it isn't worth the trouble.

Christian






Re: Functions that should be static

2008-12-20 Thread Francois Gouget
On Sat, 20 Dec 2008, Christian Costa wrote:
[...]
 If you have a class A (with methods implemented in file 1) that inherits from
 another class B (methods in file B).
 The class A may overrides some methods of B which may become unused if B is
 never instanciated and B methods not reused.
 They will be tracked by your script then.
 We could make these functions static or worst remove then but from object
 programming pov is not good.

I don't see any reason not to make the methods of B static, whether 
class A exists or not. Note that 'static' does not prevent a function 
from being called from another object file if you give a pointer to them 
to that other file (as you do with the virtual table).

Also the compiler will not complain that these functions are unused 
because they are indeed used: you take their address.


-- 
Francois Gouget fgou...@free.fr  http://fgouget.free.fr/
  The last time religion ruled, it was called the dark ages.




Re: Functions that should be static

2008-12-19 Thread Francois Gouget
On Thu, 18 Dec 2008, Christian Costa wrote:
[...]
 For 1) Why not adding a keyword to mark these functions. Something like 
 WINAPI which resolve to nothing but that can be tracked by your script.

We could potentially go this way if I merge these checks with 
winapi_check one day. But for now I prefer not to touch Wine's code. 
Besides there's really only about a handful of these.

 I would add another item for more object oriented stuff. Some default 
 implentations can be written but not always used.
 This is sort of templates. This is used in quartz for example.

Do you have a specific example of this?

-- 
Francois Gouget fgou...@free.fr  http://fgouget.free.fr/
 There are 10 types of people in the world...
   those who understand binary and those who don't.




Re: Functions that should be static

2008-12-18 Thread Christian Costa
Hi Francois,

For 1) Why not adding a keyword to mark these functions. Something like 
WINAPI which resolve to nothing but that can be tracked by your script.

I would add another item for more object oriented stuff. Some default 
implentations can be written but not always used.
This is sort of templates. This is used in quartz for example.

Christian

Francois Gouget a écrit :
 I have attached a script that identifies functions that should be made 
 static (among other things). There are approximately 450 of them, there 
 should be pretty efw false positives, and I will look into them 
 eventually. But if someone beats me to it I sure won't complain g.

 So if you do try to tackle them you are likely to find that they fall 
 into one of the following categories:

  1) Unused debug functions.
 For instance for dumping the contents of a structure to stderr. 
 Although these are unused we probably want to keep them. Let me know 
 about these and I will put them in an exception list.

  2) Functions that should be exported by a spec file
 It happens. Sometimes the developer implementing a function just 
 forgets to add it to the spec file!

  3) Generated functions
 This typically happens with widl: it generates a bunch of functions 
 for the client / server and proxy cases, but these functions may be 
 unused. I have special code to not warn about these, but there may 
 be other cases. For instance in the list below you will find a 
 number of yy*() functions generated by lex. Either we can tell lex 
 to make them static or to not generate them, or I should make 
 another special case. If you find some of these, let me know.

  4) Assembly functions
 I believe there should not be any of these in the list below.
 So if you find one let me know.

  5) Functions declared in a private header file but implemented and used 
 from a single C file.
 I'm in favor of removing these functions from the private header and 
 making them static.

  6) All the others should be pretty clear-cut.


 dlls/advapi32/advapi32.dll.so: CRYPT_DESkey8to7
 dlls/browseui/tests/browseui_test.exe.so: strdup_AtoW
 dlls/browseui/tests/browseui_test.exe.so: TestACL_ACList_AddRef
 dlls/browseui/tests/browseui_test.exe.so: TestACL_ACList_QueryInterface
 dlls/browseui/tests/browseui_test.exe.so: TestACL_ACList_Release
 dlls/browseui/tests/browseui_test.exe.so: TestACL_AddRef
 dlls/browseui/tests/browseui_test.exe.so: TestACL_Clone
 dlls/browseui/tests/browseui_test.exe.so: TestACL_Expand
 dlls/browseui/tests/browseui_test.exe.so: TestACL_Next
 dlls/browseui/tests/browseui_test.exe.so: TestACL_QueryInterface
 dlls/browseui/tests/browseui_test.exe.so: TestACL_Release
 dlls/browseui/tests/browseui_test.exe.so: TestACL_Reset
 dlls/browseui/tests/browseui_test.exe.so: TestACL_Skip
 dlls/cabinet/cabinet.dll.so: checksum
 dlls/cabinet/cabinet.dll.so: make_decode_table
 dlls/cabinet/cabinet.dll.so: QTMupdatemodel
 dlls/comctl32/tests/comctl32_test.exe.so: flush_sequence
 dlls/comdlg32/comdlg32.dll.so: CC_WMCommand
 dlls/crypt32/crypt32.dll.so: ContextList_Empty
 dlls/dbghelp/dbghelp.dll.so: hash_table_find
 dlls/dbghelp/dbghelp.dll.so: hash_table_hash
 dlls/dbghelp/dbghelp.dll.so: module_find_by_name
 dlls/dbghelp/dbghelp.dll.so: module_get_container
 dlls/dinput/dinput.dll.so: DIEnumDevicesCallbackAtoW
 dlls/dmime/dmime.dll.so: DMUSIC_CreateDirectMusicobjImpl
 dlls/dmime/dmime.dll.so: DMUSIC_CreateDirectMusicPatternTrackImpl
 dlls/dmusic/dmusic.dll.so: DMUSIC_CreateDirectMusicBufferImpl
 dlls/dmusic/dmusic.dll.so: DMUSIC_CreateDirectMusicDownloadedInstrumentImpl
 dlls/dmusic/dmusic.dll.so: DMUSIC_CreateDirectMusicDownloadImpl
 dlls/dnsapi/dnsapi.dll.so: dns_ns_name_pton
 dlls/dplayx/dplayx.dll.so: cbDeleteGroupsElem
 dlls/dplayx/dplayx.dll.so: cbDeletePlayerElem
 dlls/dplayx/dplayx.dll.so: DPLAYX_DestroyLobbyApplication
 dlls/dplayx/dplayx.dll.so: DPLAYX_SetLocalSession
 dlls/dplayx/dplayx.dll.so: NS_GetOtherMagic
 dlls/dplayx/dplayx.dll.so: NS_SetRemoteComputerAsNameServer
 dlls/dsound/dsound.dll.so: DirectSoundCaptureDevice_AddRef
 dlls/fusion/fusion.dll.so: assembly_get_architecture
 dlls/fusion/fusion.dll.so: CompareAssemblyIdentity
 dlls/fusion/fusion.dll.so: GetAssemblyIdentityFromFile
 dlls/inetcomm/inetcomm.dll.so: InternetTransport_Read
 dlls/iphlpapi/iphlpapi.dll.so: getInterfaceEntryByIndex
 dlls/iphlpapi/iphlpapi.dll.so: getInterfacePhysicalByName
 dlls/itss/itss.dll.so: chm_enumerate
 dlls/jscript/jscript.dll.so: jsdisp_call
 dlls/jscript/jscript.dll.so: parser_parse
 dlls/mountmgr.sys/mountmgr.sys.so: DriverEntry
 dlls/msacm32/msacm32.dll.so: MSACM_UnregisterLocalDriver
 dlls/mshtml/mshtml.dll.so: HTMLElementCollection_Create
 dlls/msi/msi.dll.so: cond_parse
 dlls/msi/msi.dll.so: ControlEvent_UnSubscribeToEvent
 dlls/msi/msi.dll.so: db_get_raw_stream
 dlls/msi/msi.dll.so: encode_streamname
 dlls/msi/msi.dll.so: find_published_source
 dlls/msi/msi.dll.so: