Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
G
GLib
  • Project
    • Project
    • Details
    • Activity
    • Releases
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 1,167
    • Issues 1,167
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 46
    • Merge Requests 46
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Registry
    • Registry
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • GNOME
  • GLib
  • Merge Requests
  • !568

Merged
Opened Jan 02, 2019 by Michael Catanzaro@mcatanzaro
  • Report abuse
Report abuse

Add separate definitions of g_assert_[non]null() for C++

In C++ we can use nullptr to ensure g_assert_[non]null() is only called with pointers. This will introduce build failures in tests that would have previously compiled, but only in C++, and only for code that misused these macros. Code using the macros properly will be fine.

This change caught a couple bugs in WebKit's API tests, where I had accidentally used these functions improperly. E.g. this is now a build failure in C++:

g_assert_null(webkit_context_menu_get_n_items(menu)); /* Oops! */

Either I wanted to use cmpuint there, or I wanted to use webkit_context_menu_get_items() to receive a GList* instead.

Another example that will no longer build in C++:

g_assert_null(0); /* Contrived, but 0 is not a pointer! */

  • Discussion 8
  • Commits 1
  • Pipelines 2
  • Changes 1
Assignee
No assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
2
Labels
C++ GTest
Assign labels
  • View project labels
Reference: GNOME/glib!568

Revert this merge request

This will create a new commit in order to revert the existing changes.

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.

Cherry-pick this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.