Tk Source Code

View Ticket
Login
2017-08-09
15:29 Closed ticket [03d910be56]: Revised text: compilation warning on OS X plus 4 other changes artifact: c9cb51af0a user: gcramer
2017-06-12
19:45 Ticket [03d910be56]: 4 changes artifact: 4e82636d3a user: gcramer
2017-06-11
19:39 New ticket [03d910be56]. artifact: db879fdba3 user: fvogel

Ticket UUID: 03d910be5668dcda6b98f463ccbe86aa68b66e0b
Title: Revised [text]: compilation warning on OS X
Type: Bug Version: revised_text
Submitter: fvogel Created on: 2017-06-11 19:39:10
Subsystem: 18. [text] Assigned To: gcramer
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2017-08-09 15:29:21
Resolution: None Closed By: gcramer
    Closed on: 2017-08-09 15:29:21
Description:

On OS X:

/Users/fvogel/Documents/tcltk/fossil/tk/unix/../generic/tkTextLineBreak.c:49:1: warning: unused function 'Tcl_GuardedDecrRefCount'
      [-Wunused-function]
Tcl_GuardedDecrRefCount(Tcl_Obj *objPtr)
^
1 warning generated.

This is because the only two calls to Tcl_GuardedDecrRefCount() in file tkTextLineBreak.c are inside a portion of code #ifdef __UNIX__

Should the definition of Tcl_GuardedDecrRefCount() be #ifdef'ed as well?

Moreover, why did you choose to put implementation of Tcl_GuardedDecrRefCount() on top of each file that uses it instead of factorizing it somewhere?

Finally, I'm wondering about the name Tcl_GuardedDecrRefCount. Conventions (see TIP #247, section "Names Reflect Package Structure") imply that this is a procedure exported by the Tcl package, which is in reality not the case (perhaps it should, but that's another question).

User Comments: gcramer added on 2017-06-12 19:45:31:
Version [a21d3cfd76[ now compiles without a warning.

> Finally, I'm wondering about the name Tcl_GuardedDecrRefCount. Conventions...

It's a mystery for me why Tcl does not provide a guarded version for such an important and dangerous function - an invalid call of Tcl_DecrRefCount is causing memory corruption. Obviously I cannot name this function Tk_GuardedRefCount. And I did not export this function, it is local to every implementation file, so the name doesn't matter for the world. This is answering the question why it is implemented in each file.