bugm17n - Bugs: bug #64566, typedef in m17n-core.h causing...

 
 

bug #64566: typedef in m17n-core.h causing error when compiling with C++ code

Submitter:  Qiyu Yan <karuboniru>
Submitted:  Sat 19 Aug 2023 02:32:45 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  mike_fabian
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 23 Aug 2023 09:59:20 AM UTC, comment #3: 

Fix is included in the m17n-lib-1.8.4 release:

http://download.savannah.nongnu.org/releases/m17n/m17n-lib-1.8.4.tar.gz

Commit fixing it:

https://git.savannah.nongnu.org/cgit/m17n/m17n-lib.git/commit/?id=cd9b5e3d1af6b4ba6cb9d1ea1fe87975a7cb04ff

I was afraid that this change might have been intentional to make building the documentation work, but the documentation still builds fine when I fix this regression.

Mike FABIAN <mike_fabian>
Group Member
Wed 23 Aug 2023 06:36:17 AM UTC, comment #2: 

Thank you, checking ...

Mike FABIAN <mike_fabian>
Group Member
Tue 22 Aug 2023 10:17:30 AM UTC, comment #1: 

original submission:

> line
> typedef struct MSymbol *MSymbol;
> in m17n-core.h is legal code in C but not for C++


That's correct. In C the names of structs are in their own "namespace" so `MSymbol` and `struct MSymbol` do not conflict, and you can define them to different things (although defining `MSymbol` to be `struct MSymbol*` seems very confusing and IMHO a bad idea).

In C++ the names of structs (and classes) are in the same namespace as other identifiers, and so defining `MSymbol` as a typedef conflicts with the existing declaration of `struct MSymbol`.

Jonathan Wakely <jwakely>
Sat 19 Aug 2023 02:32:45 PM UTC, original submission:  

line
typedef struct MSymbol *MSymbol;
in m17n-core.h is legal code in C but not for C++

GodBolt: (C and C++)
https://godbolt.org/z/EW9jYh7fM
https://godbolt.org/z/cG8cG9z8q

This will cause compile failure for fcitx5-m17n.

Qiyu Yan <karuboniru>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mike_fabian (Posted a comment)
  • -email is unavailable- added by jwakely (Posted a comment)
  • -email is unavailable- added by karuboniru (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-08-23 mike_fabian StatusNone Fixed
    2023-08-23 mike_fabian Open/ClosedOpen Closed
    2023-08-23 mike_fabian Assigned toNone mike_fabian

    Back to the top

    Powered by Savane 3.14-8eb0.
    Corresponding source code