- 
                Notifications
    
You must be signed in to change notification settings  - Fork 2
 
Comparing changes
Open a pull request
base repository: postgresql-cfbot/postgresql
base: cf/5509~1
head repository: postgresql-cfbot/postgresql
compare: cf/5509
- 8 commits
 - 12 files changed
 - 2 contributors
 
Commits on Nov 3, 2025
- 
  
The coccicheck.py script can be used to run several semantics patches on a source tree to either generate a report, see the context of the modification (what lines that requires changes), or generate a patch to correct an issue. usage: coccicheck.py [-h] [--verbose] [--spatch SPATCH] [--spflags SPFLAGS] [--mode {patch,report,context}] [--jobs JOBS] [--include DIR] [--patchdir DIR] pattern path [path ...] positional arguments: pattern Pattern for Cocci files to use. path Directory or source path to process. options: -h, --help show this help message and exit --verbose, -v --spatch SPATCH Path to spatch binary. Defaults to value of environment variable SPATCH. --spflags SPFLAGS Flags to pass to spatch call. Defaults to value of enviroment variable SPFLAGS. --mode {patch,report,context} Mode to use for coccinelle. Defaults to value of environment variable MODE. --jobs JOBS Number of jobs to use for spatch. Defaults to value of environment variable JOBS. --include DIR, -I DIR Extra include directories. --patchdir DIR Path for which patch should be created relative to.Configuration menu - View commit details
 - 
    
    
    
Copy full SHA for 39f1c34  - Browse repository at this point
 
Copy the full SHA 39f1c34View commit details  - 
  
Create coccicheck target for autoconf
This adds a coccicheck target for the autoconf-based build system. The coccicheck target accepts one parameter MODE, which can be either "patch", "report", or "context". The "patch" mode will generate a patch that can be applied to the source tree, the "report" mode will generate a list of file locations with information about what can be changed, and the "context" mode will just highlight the line that will be affected by the semantic patch. The following will generate a patch and apply it to the source code tree: make coccicheck MODE=patch | patch -p1Configuration menu - View commit details
 - 
    
    
    
Copy full SHA for ca50aa7  - Browse repository at this point
 
Copy the full SHA ca50aa7View commit details  - 
  
Add meson build for coccicheck
This commit adds a run target `coccicheck` to meson build files. Since ninja does not accept parameters the same way make does, there are three run targets defined---"coccicheck-patch", "coccicheck-report", and "coccicheck-context"---that you can use to generate a patch, get a report, and get the context respectively. For example, to patch the tree from the "build" subdirectory created by the meson run: ninja coccicheck-patch | patch -d .. -p1Configuration menu - View commit details
 - 
    
    
    
Copy full SHA for 23a1a84  - Browse repository at this point
 
Copy the full SHA 23a1a84View commit details  - 
  
Semantic patch for sizeof() using palloc()
If palloc() is used to allocate elements of type T it should be assigned to a variable of type T* or risk indexes out of bounds. This semantic patch checks that allocations to variables of type T* are using sizeof(T) when allocating memory using palloc().
Configuration menu - View commit details
 - 
    
    
    
Copy full SHA for af38cc1  - Browse repository at this point
 
Copy the full SHA af38cc1View commit details  - 
  
Semantic patch for palloc_array and palloc_object
Macros were added to the palloc API in commit 2016055 to improve type-safety, but very few instances were replaced. This adds a cocci script to do that replacement. The semantic patch deliberately do not replace instances where the type of the variable and the type used in the macro does not match.
Configuration menu - View commit details
 - 
    
    
    
Copy full SHA for 54aaa7b  - Browse repository at this point
 
Copy the full SHA 54aaa7bView commit details  - 
  
Configuration menu - View commit details
 - 
    
    
    
Copy full SHA for c2fc7e8  - Browse repository at this point
 
Copy the full SHA c2fc7e8View commit details  - 
  
Semantic patch to use stack-allocated StringInfoData
This semantic patch replace uses of StringInfo with StringInfoData where the info is dynamically allocated but (optionally) freed at the end of the block. This will avoid one dynamic allocation that otherwise have to be dealt with. For example, this code: StringInfo info = makeStringInfo(); ... appendStringInfo(info, ...); ... return do_stuff(..., info->data, ...); Can be replaced with: StringInfoData info; initStringInfo(&info); ... appendStringInfo(&info, ...); ... return do_stuff(..., info.data, ...); It does not do a replacement in these cases: - If the variable is assigned to an expression. In this case, the pointer can "leak" outside the function either through a global variable or a parameter assignment. - If an assignment is done to the expression. This cannot leak the data, but could mean a value-assignment of a structure, so we avoid this case. - If the pointer is returned.Configuration menu - View commit details
 - 
    
    
    
Copy full SHA for 33ccb38  - Browse repository at this point
 
Copy the full SHA 33ccb38View commit details  - 
  
[CF 5509] Coccinelle for PostgreSQL development
This branch was automatically generated by a robot using patches from an email thread registered at: https://commitfest.postgresql.org/patch/5509 The branch will be overwritten each time a new patch version is posted to the thread, and also periodically to check for bitrot caused by changes on the master branch. Patch(es): https://www.postgresql.org/message-id/[email protected] Author(s): Mats Kindahl
Commitfest Bot committedNov 3, 2025 Configuration menu - View commit details
 - 
    
    
    
Copy full SHA for 5fcf742  - Browse repository at this point
 
Copy the full SHA 5fcf742View commit details  
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
            You can try running this command locally to see the comparison on your machine: 
            git diff cf/5509~1...cf/5509