Skip to content
This repository was archived by the owner on Jun 8, 2021. It is now read-only.

Regen #81

Merged
merged 4 commits into from
Mar 13, 2018
Merged

Regen #81

merged 4 commits into from
Mar 13, 2018

Conversation

EPashkin
Copy link
Member

@EPashkin EPashkin commented Mar 1, 2018

Apply gtk-rs/gir-files#15

Also contains deignoring string constants

@EPashkin
Copy link
Member Author

EPashkin commented Mar 1, 2018

@GuillaumeGomez, @sdroege, @tmiasko
I not sure about deignoring constants. Maybe its really needed ignored as used in C printing functions.

@@ -3675,7 +3675,7 @@ pub struct GdkEventTouchpadPinch {
pub type_: GdkEventType,
pub window: *mut GdkWindow,
pub send_event: i8,
pub phase: GdkTouchpadGesturePhase,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it normal?

@EPashkin
Copy link
Member Author

EPashkin commented Mar 1, 2018

Yes, you merged patch to gir-files today, see gtk-rs/gir#555 (comment) for reasoning

@GuillaumeGomez
Copy link
Member

Indeed, then all good for me!

//pub const G_GUINT64_FORMAT: *const c_char = b"lu\0" as *const u8 as *const c_char;
//pub const G_GUINTPTR_FORMAT: *const c_char = b"lu\0" as *const u8 as *const c_char;
pub const G_GUINT64_FORMAT: *const c_char = b"lu\0" as *const u8 as *const c_char;
pub const G_GUINTPTR_FORMAT: *const c_char = b"lu\0" as *const u8 as *const c_char;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These constants are all useless in Rust. They only make sense with printf-style API, but fortunately we have a better format string system in Rust

pub const G_GSIZE_FORMAT: *const c_char = b"lu\0" as *const u8 as *const c_char;
pub const G_GSIZE_MODIFIER: *const c_char = b"l\0" as *const u8 as *const c_char;
pub const G_GSSIZE_FORMAT: *const c_char = b"li\0" as *const u8 as *const c_char;
pub const G_GSSIZE_MODIFIER: *const c_char = b"l\0" as *const u8 as *const c_char;
pub const G_GUINT16_FORMAT: *const c_char = b"hu\0" as *const u8 as *const c_char;
pub const G_GUINT32_FORMAT: *const c_char = b"u\0" as *const u8 as *const c_char;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I.e. even these existing ones were useless.

pub const G_GUINT16_FORMAT: *const c_char = b"hu\0" as *const u8 as *const c_char;
pub const G_GUINT32_FORMAT: *const c_char = b"u\0" as *const u8 as *const c_char;
//pub const G_GUINT64_FORMAT: *const c_char = b"lu\0" as *const u8 as *const c_char;
//pub const G_GUINTPTR_FORMAT: *const c_char = b"lu\0" as *const u8 as *const c_char;
pub const G_GUINT64_FORMAT: *const c_char = b"lu\0" as *const u8 as *const c_char;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this one for example is platform dependent. Both CPU and compiler (MSVC again)

@EPashkin
Copy link
Member Author

EPashkin commented Mar 2, 2018

Then I ignore it again

@EPashkin
Copy link
Member Author

EPashkin commented Mar 9, 2018

Ignored more constants
Added fixes for GPid and GPollFD

Still don't contains update to right gir submodule.

@EPashkin
Copy link
Member Author

EPashkin commented Mar 9, 2018

Appveyor failed on 64x build as glib have some GPid functions.

//pub const G_GINT64_FORMAT: *const c_char = b"li\0" as *const u8 as *const c_char;
//pub const G_GINT64_MODIFIER: *const c_char = b"l\0" as *const u8 as *const c_char;
//pub const G_GINTPTR_FORMAT: *const c_char = b"li\0" as *const u8 as *const c_char;
//pub const G_GINTPTR_MODIFIER: *const c_char = b"l\0" as *const u8 as *const c_char;
pub const G_GNUC_FUNCTION: *const c_char = b"\0" as *const u8 as *const c_char;
pub const G_GNUC_PRETTY_FUNCTION: *const c_char = b"\0" as *const u8 as *const c_char;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are also both useless, needs a C compiler to do something

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -648,24 +651,8 @@ pub const G_DATE_BAD_YEAR: c_int = 0;
pub const G_DIR_SEPARATOR: c_int = 92;
pub const G_DIR_SEPARATOR_S: *const c_char = b"\\\0" as *const u8 as *const c_char;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two are platform specific (hello Windows)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I just ignored it wrong.

pub const G_GUINT16_FORMAT: *const c_char = b"hu\0" as *const u8 as *const c_char;
pub const G_GUINT32_FORMAT: *const c_char = b"u\0" as *const u8 as *const c_char;
//pub const G_GUINT64_FORMAT: *const c_char = b"lu\0" as *const u8 as *const c_char;
//pub const G_GUINTPTR_FORMAT: *const c_char = b"lu\0" as *const u8 as *const c_char;
pub const G_HAVE_GINT64: c_int = 1;
pub const G_HAVE_GNUC_VARARGS: c_int = 1;
pub const G_HAVE_GNUC_VISIBILITY: c_int = 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 3 are useless outside C too

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -720,10 +707,6 @@ pub const G_MAXUINT32: u32 = 4294967295;
pub const G_MAXUINT64: u64 = 18446744073709551615;
pub const G_MAXUINT8: u8 = 255;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as are these

//pub const G_MININT16: i16 = -32768;
//pub const G_MININT32: i32 = -2147483648;
pub const G_MININT64: i64 = -9223372036854775808;
//pub const G_MININT8: i8 = -128;
pub const GLIB_MINOR_VERSION: c_int = 54;
pub const G_MODULE_SUFFIX: *const c_char = b"so\0" as *const u8 as *const c_char;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is platform specific

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -740,10 +723,6 @@ pub const G_PRIORITY_HIGH_IDLE: c_int = 100;
pub const G_PRIORITY_LOW: c_int = 300;
pub const G_SEARCHPATH_SEPARATOR: c_int = 59;
pub const G_SEARCHPATH_SEPARATOR_S: *const c_char = b";\0" as *const u8 as *const c_char;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Platform specific

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO is not

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's ; on Windows and : everywhere else

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, really.
Strange that it have constant name="SEARCHPATH_SEPARATOR_S" value=";" c:type="G_SEARCHPATH_SEPARATOR_S in ubuntu GLib-2.0.gir.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a bug in g-ir-scanner. It tries to parse macro definition without actually implementing a proper C preprocessing step. If macros have conditional definitions then it is quite likely to give wrong results.

It would be nice to extend ABI checker to constants as well. I would expect to find a lot of incorrect things there.

use libc::{c_int, c_ushort};

#[cfg(all(windows,target_arch="x86_64"))]
pub type GPid = i64; //Actually HANDLE aka void*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be a *mut c_void then?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It depend of #82 discussion

@sdroege
Copy link
Member

sdroege commented Mar 9, 2018

Basically most of the GLib constants are not very useful. Opt-in instead of opt-out for each of them would be more convenient I guess

@EPashkin
Copy link
Member Author

EPashkin commented Mar 9, 2018

Bad that we can't Opt-in for constants in sys mode

@EPashkin
Copy link
Member Author

EPashkin commented Mar 9, 2018

Fixed almost all nits.

@EPashkin
Copy link
Member Author

EPashkin commented Mar 9, 2018

Almost final version, only may have changes from glib problem.

@EPashkin
Copy link
Member Author

I restarted Appveyor.

//pub const G_GUINTPTR_FORMAT: *const c_char = b"lu\0" as *const u8 as *const c_char;
pub const G_HAVE_GINT64: c_int = 1;
pub const G_HAVE_GNUC_VARARGS: c_int = 1;
pub const G_HAVE_GNUC_VISIBILITY: c_int = 1;
pub const G_HAVE_GROWING_STACK: c_int = 0;
pub const G_HAVE_ISO_VARARGS: c_int = 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should go away, these two. basically all G_HAVE_.* and G_.*FORMAT and G_.*MODIFIER

//pub const G_MININT16: i16 = -32768;
//pub const G_MININT32: i32 = -2147483648;
pub const G_MININT64: i64 = -9223372036854775808;
//pub const G_MININT8: i8 = -128;
pub const GLIB_MINOR_VERSION: c_int = 54;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As written in another ticket somewhere, these are kind of useless too

pub type GPid = *mut c_void;

#[cfg(not(windows))]
pub type GPid = c_int;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

pub struct GPollFD {
pub fd: c_int,
pub events: c_ushort,
pub revents: c_ushort,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@EPashkin EPashkin force-pushed the regen branch 2 times, most recently from bcf5421 to d826521 Compare March 11, 2018 10:45
@EPashkin
Copy link
Member Author

Removed version constants in glib and in others.

@EPashkin
Copy link
Member Author

@GuillaumeGomez IMHO this ready for merge now

@GuillaumeGomez
Copy link
Member

Indeed, thanks!

@GuillaumeGomez GuillaumeGomez merged commit e01a0e0 into gtk-rs:master Mar 13, 2018
@EPashkin EPashkin deleted the regen branch March 13, 2018 16:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants