-
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 Mar 29, 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 0670e49 - Browse repository at this point
Copy the full SHA 0670e49View 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 -p1
Configuration menu - View commit details
-
Copy full SHA for c1f7155 - Browse repository at this point
Copy the full SHA c1f7155View 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 .. -p1
Configuration menu - View commit details
-
Copy full SHA for 18bef14 - Browse repository at this point
Copy the full SHA 18bef14View 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 cebab18 - Browse repository at this point
Copy the full SHA cebab18View 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 c7f0fa4 - Browse repository at this point
Copy the full SHA c7f0fa4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6a55648 - Browse repository at this point
Copy the full SHA 6a55648View 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 3f1ded6 - Browse repository at this point
Copy the full SHA 3f1ded6View 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/CA+14427LS9jKY2FuLwE5extZHK5DDzjFa_YG88yQ3k16WZ=How@mail.gmail.com Author(s): Mats Kindahl
Commitfest Bot committedMar 29, 2025 Configuration menu - View commit details
-
Copy full SHA for aa07a20 - Browse repository at this point
Copy the full SHA aa07a20View 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