gfx: Make some global functions static and remove some unused functions

NEW
Assigned to

Status

()

enhancement
P3
normal
3 months ago
2 months ago

People

(Reporter: cpeterson, Assigned: cpeterson)

Tracking

(Blocks 1 bug, {leave-open})

unspecified
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox-esr60 wontfix, firefox65 wontfix, firefox66 wontfix, firefox67 affected)

Details

Attachments

(9 attachments)

47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
Assignee

Description

3 months ago

clang's -Wmissing-prototypes option identifies global functions that can be made static (because they're only called from one compilation unit) or removed (if they're never called).

Green Try build:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=e0659997a04319207842faac852546f363e17b69

Assignee

Comment 1

3 months ago

clang's -Wmissing-prototypes option identifies global functions that can be made static (because they're only called from one compilation unit) or removed (if they're never called).

gfx/thebes/gfxBlur.cpp:444:6 [-Wmissing-prototypes] no previous prototype for function 'CacheBlur'
gfx/thebes/gfxPlatform.cpp:1087:6 [-Wmissing-prototypes] no previous prototype for function 'IsFeatureSupported'
gfx/thebes/gfxPlatform.cpp:1355:6 [-Wmissing-prototypes] no previous prototype for function 'SourceBufferDestroy'
gfx/thebes/gfxPlatform.cpp:1365:6 [-Wmissing-prototypes] no previous prototype for function 'SourceSurfaceDestroyed'
gfx/thebes/gfxPlatform.cpp:2422:6 [-Wmissing-prototypes] no previous prototype for function 'VideoDecodingFailedChangedCallback'
gfx/thebes/gfxPlatform.cpp:559:6 [-Wmissing-prototypes] no previous prototype for function 'WebRenderDebugPrefChangeCallback'

widget/GfxInfoBase.cpp:82:6 [-Wmissing-prototypes] no previous prototype for function 'InitGfxDriverInfoShutdownObserver'

Assignee

Comment 2

3 months ago

clang's -Wmissing-prototypes option identifies global functions that can be made static (because they're only called from one compilation unit) or removed (if they're never called).

CreateDefaultTarget()
NS_HSL2RGB()

widget/headless/HeadlessWidget.cpp:49:30 [-Wmissing-prototypes] no previous prototype for function 'CreateDefaultTarget'

Depends on D20260

Assignee

Comment 3

3 months ago

FAST_DIVIDE_BY_255 was defined in nsColor.h but only used in nsColor.cpp.

Depends on D20261

Assignee

Comment 4

3 months ago

And #include "BufferUnrotate.h" in BufferUnrotate.cpp for BufferUnrotate() function prototype.

clang's -Wmissing-prototypes option identifies global functions that can be made static (because they're only called from one compilation unit) or removed (if they're never called).

gfx/2d/BufferUnrotate.cpp:17:6 [-Wmissing-prototypes] no previous prototype for function 'BufferUnrotate'
gfx/2d/DrawTargetCairo.cpp:195:6 [-Wmissing-prototypes] no previous prototype for function 'ReleaseData'
gfx/2d/DrawTargetCairo.cpp:201:18 [-Wmissing-prototypes] no previous prototype for function 'CopyToImageSurface'
gfx/2d/DrawTargetCairo.cpp:239:18 [-Wmissing-prototypes] no previous prototype for function 'GetAsImageSurface'
gfx/2d/DrawTargetCairo.cpp:251:18 [-Wmissing-prototypes] no previous prototype for function 'CreateSubImageForData'
gfx/2d/DrawTargetCairo.cpp:272:18 [-Wmissing-prototypes] no previous prototype for function 'ExtractSubImage'
gfx/2d/DrawTargetCairo.cpp:308:18 [-Wmissing-prototypes] no previous prototype for function 'GetCairoSurfaceForSourceSurface'
gfx/2d/DrawTargetRecording.cpp:26:6 [-Wmissing-prototypes] no previous prototype for function 'RecordingSourceSurfaceUserDataFunc'
gfx/2d/DrawTargetRecording.cpp:272:6 [-Wmissing-prototypes] no previous prototype for function 'RecordingFontUserDataDestroyFunc'
gfx/2d/DrawTargetWrapAndRecord.cpp:26:6 [-Wmissing-prototypes] no previous prototype for function 'WrapAndRecordSourceSurfaceUserDataFunc'
gfx/2d/DrawTargetWrapAndRecord.cpp:358:6 [-Wmissing-prototypes] no previous prototype for function 'WrapAndRecordFontUserDataDestroyFunc'
gfx/2d/FilterNodeSoftware.cpp:1816:6 [-Wmissing-prototypes] no previous prototype for function 'IsAllZero'
gfx/2d/FilterNodeSoftware.cpp:183:37 [-Wmissing-prototypes] no previous prototype for function 'CloneAligned'
gfx/2d/MacIOSurface.cpp:442:6 [-Wmissing-prototypes] no previous prototype for function 'MacIOSurfaceBufferDeallocator'
gfx/2d/QuartzSupport.mm:38:6 [-Wmissing-prototypes] no previous prototype for function 'cgdata_release_callback'
gfx/2d/ScaledFontMac.cpp:191:10 [-Wmissing-prototypes] no previous prototype for function 'CalcTableChecksum'
gfx/2d/ScaledFontMac.cpp:224:5 [-Wmissing-prototypes] no previous prototype for function 'maxPow2LessThan'
gfx/2d/unittest/TestCairo.cpp:12:6 [-Wmissing-prototypes] no previous prototype for function 'TryCircle'

Depends on D20262

Assignee

Comment 5

3 months ago

clang's -Wmissing-prototypes option identifies global functions that can be made static (because they're only called from one compilation unit) or removed (if they're never called).

gfx/gl/GfxTexturesReporter.cpp:22:13 [-Wmissing-prototypes] no previous prototype for function 'FormatBytes'
gfx/gl/GLContextFeatures.cpp:534:6 [-Wmissing-prototypes] no previous prototype for function 'IsFeaturePartOfProfileVersion'

Depends on D20263

Assignee

Comment 6

3 months ago

clang's -Wmissing-prototypes option identifies global functions that can be made static (because they're only called from one compilation unit) or removed (if they're never called).

gfx/layers/composite/ContainerLayerComposite.cpp:132:6 [-Wmissing-prototypes] no previous prototype for function 'TransformLayerGeometry'
gfx/layers/composite/LayerManagerComposite.cpp:1409:6 [-Wmissing-prototypes] no previous prototype for function 'ComputeVisibleRegionForChildren'
gfx/layers/composite/LayerManagerComposite.cpp:234:6 [-Wmissing-prototypes] no previous prototype for function 'ShouldProcessLayer'
gfx/layers/composite/TiledContentHost.cpp:156:6 [-Wmissing-prototypes] no previous prototype for function 'UseTileTexture'
gfx/layers/ipc/CompositorBridgeParent.cpp:1827:6 [-Wmissing-prototypes] no previous prototype for function 'EraseLayerState'
gfx/layers/ipc/CompositorBridgeParent.cpp:2140:6 [-Wmissing-prototypes] no previous prototype for function 'UpdateIndirectTree'
gfx/layers/opengl/OGLShaderProgram.cpp:28:6 [-Wmissing-prototypes] no previous prototype for function 'AddUniforms'

Depends on D20264

Assignee

Comment 7

3 months ago

clang's -Wmissing-prototypes option identifies global functions that can be made static (because they're only called from one compilation unit) or removed (if they're never called).

gfx/layers/Layers.cpp:58:7 [-Wmissing-prototypes] no previous prototype for function 'FILEOrDefault'
gfx/layers/ipc/CompositorThread.cpp:26:25 [-Wmissing-prototypes] no previous prototype for function 'GetCompositorThreadHolder'
MINIMUM_TILE_COPY_AREA()

Depends on D20265

Assignee

Comment 8

3 months ago

clang's -Wmissing-prototypes option identifies global functions that can be made static (because they're only called from one compilation unit) or removed (if they're never called).

In this case, moving ShutdownTileCache()'s function declaration to the header file TiledContentClient.h means the same declaration will be seen by the TiledContentClient.cpp file defining the function and the gfxPlatform.cpp calling the function.

gfx/layers/client/TiledContentClient.cpp:337:6 [-Wmissing-prototypes] no previous prototype for function 'ShutdownTileCache'

Depends on D20266

Assignee

Comment 9

3 months ago

clang's -Wmissing-prototypes option identifies global functions that can be made static (because they're only called from one compilation unit) or removed (if they're never called).

In this case, moving these functions' declarations to header files means the same declaration will be seen by the .cpp files defining each function and TextureHost.cpp calling the functions.

Depends on D20267

Comment 10

3 months ago
Pushed by cpeterson@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/7183e211d4eb
Part 4: gfx/2d: Make some global functions static. r=lsalzman
https://hg.mozilla.org/integration/mozilla-inbound/rev/60252879d73c
Part 7: gfx/layers: Remove some unused functions. r=mattwoodrow
Assignee

Updated

3 months ago
Keywords: leave-open

Comment 12

3 months ago
Pushed by cpeterson@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/0573c6c669be
Part 1: gfx/thebes: Make some global functions static. r=jrmuizel
https://hg.mozilla.org/integration/mozilla-inbound/rev/d87672a99667
Part 2: gfx: Remove some unused functions. r=jrmuizel
https://hg.mozilla.org/integration/mozilla-inbound/rev/43d876b37031
Part 3: gfx: Move FAST_DIVIDE_BY_255 macro definition to nsColor.cpp. r=jrmuizel
https://hg.mozilla.org/integration/mozilla-inbound/rev/53e277d161b2
Part 6: gfx/layers: Make some global functions static. r=mattwoodrow
https://hg.mozilla.org/integration/mozilla-inbound/rev/13bf48ec0625
Part 8: gfx/layers: Move ShutdownTileCache() function declaration to header file. r=mattwoodrow
https://hg.mozilla.org/integration/mozilla-inbound/rev/0df9a1e522af
Part 9: gfx/layers: Move CreateTextureHostBasic/D3D11/OGL() function declarations to header files. r=mattwoodrow
https://hg.mozilla.org/projects/oak/rev/0573c6c669be0434b630bb90051298aaa5159ccc
Bug 1528881 - Part 1: gfx/thebes: Make some global functions static. r=jrmuizel

https://hg.mozilla.org/projects/oak/rev/d87672a996677236c209cc6a067a84b9fb92e0e5
Bug 1528881 - Part 2: gfx: Remove some unused functions. r=jrmuizel

https://hg.mozilla.org/projects/oak/rev/43d876b370317974ccc221278551be1b509d1647
Bug 1528881 - Part 3: gfx: Move FAST_DIVIDE_BY_255 macro definition to nsColor.cpp. r=jrmuizel

https://hg.mozilla.org/projects/oak/rev/53e277d161b2d43dccbc3b294ef14212bd4f9314
Bug 1528881 - Part 6: gfx/layers: Make some global functions static. r=mattwoodrow

https://hg.mozilla.org/projects/oak/rev/13bf48ec0625e11cd3a21e0db5da6bbc26b965fa
Bug 1528881 - Part 8: gfx/layers: Move ShutdownTileCache() function declaration to header file. r=mattwoodrow

https://hg.mozilla.org/projects/oak/rev/0df9a1e522afbc4fedd23fa72bc307aac7d06185
Bug 1528881 - Part 9: gfx/layers: Move CreateTextureHostBasic/D3D11/OGL() function declarations to header files. r=mattwoodrow
Assignee

Updated

2 months ago
Blocks: 536427
Assignee

Updated

2 months ago
See Also: 536427
You need to log in before you can comment on or make changes to this bug.